summaryrefslogtreecommitdiff
path: root/tools/format.py
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-07-19 21:06:48 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-07-20 03:46:26 -0400
commita7bf154cb8bb47196e4c83efa1a61d73842a09b5 (patch)
treefcd27615a6231d6ad9caaaadd14233645acbf14c /tools/format.py
parentc67d98eb7fed91b8ae70929e8fe43cecbe39d23c (diff)
Wrap rust at 80 columns.
Diffstat (limited to 'tools/format.py')
-rwxr-xr-xtools/format.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/format.py b/tools/format.py
index fc11ced4d..cb3b15a7e 100755
--- a/tools/format.py
+++ b/tools/format.py
@@ -8,6 +8,8 @@ root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
third_party_path = os.path.join(root_path, "third_party")
prettier = os.path.join(third_party_path, "node_modules", "prettier",
"bin-prettier.js")
+tools_path = os.path.join(root_path, "tools")
+rustfmt_config = os.path.join(tools_path, "rustfmt.toml")
os.chdir(root_path)
# TODO(ry) Install clang-format in third_party.
@@ -24,5 +26,7 @@ run(["node", prettier, "--write"] + glob("js/*.js") + glob("js/*.ts") +
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"))
+run([
+ "rustfmt", "--config-path", rustfmt_config, "--error-on-unformatted",
+ "--write-mode", "overwrite"
+] + rustfmt_extra_args + glob("src/*.rs"))