aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_toolchain/src/lib.rs4
-rw-r--r--crates/rust-analyzer/Cargo.toml1
-rw-r--r--crates/rust-analyzer/src/handlers.rs2
3 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_toolchain/src/lib.rs b/crates/ra_toolchain/src/lib.rs
index 3d2865e09..9532fb255 100644
--- a/crates/ra_toolchain/src/lib.rs
+++ b/crates/ra_toolchain/src/lib.rs
@@ -15,6 +15,10 @@ pub fn rustup() -> PathBuf {
15 get_path_for_executable("rustup") 15 get_path_for_executable("rustup")
16} 16}
17 17
18pub fn rustfmt() -> PathBuf {
19 get_path_for_executable("rustfmt")
20}
21
18/// Return a `PathBuf` to use for the given executable. 22/// Return a `PathBuf` to use for the given executable.
19/// 23///
20/// E.g., `get_path_for_executable("cargo")` may return just `cargo` if that 24/// E.g., `get_path_for_executable("cargo")` may return just `cargo` if that
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 08c67ddd0..122a1605f 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -41,6 +41,7 @@ ra_text_edit = { path = "../ra_text_edit" }
41vfs = { path = "../vfs" } 41vfs = { path = "../vfs" }
42vfs-notify = { path = "../vfs-notify" } 42vfs-notify = { path = "../vfs-notify" }
43ra_cfg = { path = "../ra_cfg"} 43ra_cfg = { path = "../ra_cfg"}
44ra_toolchain = { path = "../ra_toolchain" }
44 45
45# This should only be used in CLI 46# This should only be used in CLI
46ra_db = { path = "../ra_db" } 47ra_db = { path = "../ra_db" }
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 6c21f25fe..38e3c3324 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -650,7 +650,7 @@ pub(crate) fn handle_formatting(
650 650
651 let mut rustfmt = match &snap.config.rustfmt { 651 let mut rustfmt = match &snap.config.rustfmt {
652 RustfmtConfig::Rustfmt { extra_args } => { 652 RustfmtConfig::Rustfmt { extra_args } => {
653 let mut cmd = process::Command::new("rustfmt"); 653 let mut cmd = process::Command::new(ra_toolchain::rustfmt());
654 cmd.args(extra_args); 654 cmd.args(extra_args);
655 if let Some(&crate_id) = crate_ids.first() { 655 if let Some(&crate_id) = crate_ids.first() {
656 // Assume all crates are in the same edition 656 // Assume all crates are in the same edition