pre-upload.py: Use 2018 edition for rustfmt
async/await is only allowed with the 2018 edition for rust and this was
causing upload hook errors for files that contained those keywords.
BUG=none
TEST=run hooks on a file with async/await and see that it doesn't fail
Change-Id: I19b730a62cccb7f4f08b2ad6e022a661bf7c345b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/2294657
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 182123e..e22a032 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -635,7 +635,8 @@
for rustfile in files:
contents = _get_file_content(rustfile, commit)
- output = _run_command(cmd=['rustfmt'], input=contents.encode('utf-8'),
+ output = _run_command(cmd=['rustfmt', '--edition', '2018'],
+ input=contents.encode('utf-8'),
stderr=subprocess.STDOUT)
if output != contents:
errors.append(rustfile)