Revert "pre-upload: add cargo_fmt_check presubmit hook"
The rustfmt pre-upload check is more generic and replaces the cargo fmt
check.
This reverts commit a66f576c8bb4532f781f82ef8776cf03d4358798.
BUG=chromium:908640
TEST=`repo upload` with an unformatted Rust change
CQ-DEPEND=CL:1376070
Change-Id: Ie6e7aa689049bf72ba8dd0e94ecca8ce40dd9fdd
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1376350
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 32ccd8d..460e4af 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -1219,36 +1219,6 @@
# Project-specific hooks
-def _check_cargo_fmt(_project, _commit, options=()):
- """Runs cargo fmt on the given project.
-
- If specified, options is a list of directories to run cargo fmt in
- (rather than at the root of the project).
- """
- pwd = os.getcwd()
- cmd = ['cargo', 'fmt', '--all', '--', '--check']
- errors = ''
-
- # Check from the root of the project if no options were specified.
- if not options:
- options = ('.')
-
- for path in options:
- os.chdir(os.path.join(pwd, path))
- cmd_result = cros_build_lib.RunCommand(cmd=cmd,
- print_cmd=False,
- stdout_to_pipe=True,
- combine_stdout_stderr=True,
- error_code_ok=True)
- if cmd_result.returncode:
- errors += cmd_result.output + '\n'
-
- os.chdir(pwd)
-
- if errors:
- return HookFailure('cargo fmt errors\n\n' + errors)
-
-
def _check_clang_format(_project, commit, options=()):
"""Runs clang-format on the given project"""
hooks_dir = _get_hooks_dir()
@@ -1635,7 +1605,6 @@
# A dictionary of flags (keys) that can appear in the config file, and the hook
# that the flag controls (value).
_HOOK_FLAGS = {
- 'cargo_fmt_check': _check_cargo_fmt,
'clang_format_check': _check_clang_format,
'checkpatch_check': _run_checkpatch,
'kerneldoc_check': _run_kerneldoc,