Use rustfmt from third_party/rust-toolchain/bin directory.

Chromium now has rust toolchain in a well-established directory, which is properly gated with `use_rust` gclient variable. External projects can setup this directory using their own toolchains and have rustfmt work properly in presubmit format checks.

Bug: 1395070
Change-Id: I3d1de8278b9da0db1cdb75673cb7d637ce0273ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4070004
Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: danakj <danakj@chromium.org>
changes/04/4070004/5
Aleksey Khoroshilov 2 years ago committed by LUCI CQ
parent b5b80d27b5
commit 6e33ba049f

@ -31,11 +31,8 @@ def FindRustfmtToolInChromiumTree():
'Could not find checkout in any parent of the current path.\n'
'Set CHROMIUM_BUILDTOOLS_PATH to use outside of a chromium checkout.')
# TODO(lukasza): Deduplicate the is-Rust-supported and find-Rust-binaries code
# by somehow sharing the `rust_prefix` variable from //build/config/rust.gni
tool_path = os.path.join(chromium_src_path, 'third_party',
'android_rust_toolchain', 'toolchain', 'bin',
'rustfmt' + gclient_paths.GetExeSuffix())
tool_path = os.path.join(chromium_src_path, 'third_party', 'rust-toolchain',
'bin', 'rustfmt' + gclient_paths.GetExeSuffix())
if not os.path.exists(tool_path):
raise NotFoundError('File does not exist: %s' % tool_path)
return tool_path

Loading…
Cancel
Save