mirror of
https://github.com/servo/servo.git
synced 2025-07-17 12:23:40 +01:00
Auto merge of #21376 - JoshBrudnak:master, r=jdm
Add rustfmt command to devenv commands Added the rustfmt command to devenv commands which runs cargo fmt on a specified directory. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #21374 <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because they only included a simple command that was added to the devenv_commands python script. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21376) <!-- Reviewable:end -->
This commit is contained in:
commit
c362ade094
1 changed files with 13 additions and 0 deletions
|
@ -229,6 +229,19 @@ class MachCommands(CommandBase):
|
|||
with cd(self.context.topdir):
|
||||
return self.call_rustup_run(["cargo", "fetch"], env=self.build_env())
|
||||
|
||||
@Command('rustfmt',
|
||||
description='Format the Rust code using Cargo fmt',
|
||||
category='devenv')
|
||||
@CommandArgument(
|
||||
'--directory', '-d', default=None,
|
||||
help='Command-line argument to specify the directory for formatting')
|
||||
def rustfmt(self, directory=""):
|
||||
if directory == "":
|
||||
directory = self.context.topdir
|
||||
|
||||
with cd(self.context.topdir):
|
||||
return self.call_rustup_run(["cargo", "fmt", "--", directory], env=self.build_env())
|
||||
|
||||
@Command('ndk-stack',
|
||||
description='Invoke the ndk-stack tool with the expected symbol paths',
|
||||
category='devenv')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue