Skip to content

Commit b1a4e81

Browse files
bors[bot]matklad
andauthored
Merge #5087
5087: Try to find rustfmt in more places r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 2dcab13 + 9617bb4 commit b1a4e81

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_toolchain/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ pub fn rustup() -> PathBuf {
1515
get_path_for_executable("rustup")
1616
}
1717

18+
pub fn rustfmt() -> PathBuf {
19+
get_path_for_executable("rustfmt")
20+
}
21+
1822
/// Return a `PathBuf` to use for the given executable.
1923
///
2024
/// E.g., `get_path_for_executable("cargo")` may return just `cargo` if that

crates/rust-analyzer/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ra_text_edit = { path = "../ra_text_edit" }
4141
vfs = { path = "../vfs" }
4242
vfs-notify = { path = "../vfs-notify" }
4343
ra_cfg = { path = "../ra_cfg"}
44+
ra_toolchain = { path = "../ra_toolchain" }
4445

4546
# This should only be used in CLI
4647
ra_db = { path = "../ra_db" }

crates/rust-analyzer/src/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ pub(crate) fn handle_formatting(
650650

651651
let mut rustfmt = match &snap.config.rustfmt {
652652
RustfmtConfig::Rustfmt { extra_args } => {
653-
let mut cmd = process::Command::new("rustfmt");
653+
let mut cmd = process::Command::new(ra_toolchain::rustfmt());
654654
cmd.args(extra_args);
655655
if let Some(&crate_id) = crate_ids.first() {
656656
// Assume all crates are in the same edition

0 commit comments

Comments
 (0)