summaryrefslogtreecommitdiff
path: root/tools/format.py
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-10 19:18:30 -0400
committerGitHub <noreply@github.com>2018-07-10 19:18:30 -0400
commit791357115c0aa1e4f87f70c57327bc66928b5019 (patch)
treeffc0fee113940687e47ec64ab352defd3364c4e3 /tools/format.py
parent4f626098eca99efc79e71b4839084d730473b696 (diff)
Remove -f option from rustfmt. (#356)
And add support for RUSTFMT_FLAGS (Some people might need -f option)
Diffstat (limited to 'tools/format.py')
-rwxr-xr-xtools/format.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/format.py b/tools/format.py
index 40ca58d4c..d0d54e314 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -19,4 +19,10 @@ for fn in ["BUILD.gn", ".gn"] + glob("build_extra/**/*.gn*"):
run(["yapf", "-i"] + glob("tools/*.py"))
run(["node", prettier, "--write"] + glob("js/*.js") + glob("js/*.ts") +
["tsconfig.json"] + ["tslint.json"])
-run(["rustfmt", "-f", "--write-mode", "overwrite"] + glob("src/*.rs"))
+
+# Set RUSTFMT_FLAGS for extra flags.
+rustfmt_extra_args = []
+if 'RUSTFMT_FLAGS' in os.environ:
+ rustfmt_extra_args += os.environ['RUSTFMT_FLAGS'].split()
+run(["rustfmt", "--write-mode", "overwrite"] + rustfmt_extra_args +
+ glob("src/*.rs"))