From fc0a86c038f54d90c34da63bcf7a6750e8092b72 Mon Sep 17 00:00:00 2001 From: JoshBrudnak Date: Thu, 9 Aug 2018 17:26:04 -0400 Subject: [PATCH 1/2] Add rustfmt command to devenv commands --- python/servo/devenv_commands.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index c6a3f8527ba..c61a5f781e5 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -227,3 +227,16 @@ 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()) From 936ec085fd128573c6a071c13744138a7a2455f1 Mon Sep 17 00:00:00 2001 From: josh Date: Fri, 10 Aug 2018 13:47:01 -0400 Subject: [PATCH 2/2] Remove trailing whitespace in devenv_commands --- python/servo/devenv_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/servo/devenv_commands.py b/python/servo/devenv_commands.py index f6532b57097..31bfc8f48bd 100644 --- a/python/servo/devenv_commands.py +++ b/python/servo/devenv_commands.py @@ -228,7 +228,7 @@ 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') @@ -241,7 +241,7 @@ class MachCommands(CommandBase): 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')