diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/format.py | 8 | ||||
-rw-r--r-- | tools/rustfmt.toml | 1 |
2 files changed, 7 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")) diff --git a/tools/rustfmt.toml b/tools/rustfmt.toml new file mode 100644 index 000000000..df99c6919 --- /dev/null +++ b/tools/rustfmt.toml @@ -0,0 +1 @@ +max_width = 80 |