diff options
author | Aleksey Kladov <[email protected]> | 2020-06-27 00:28:06 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-27 00:28:06 +0100 |
commit | 9617bb4f07f724b25abd4040a960f5ccff97b569 (patch) | |
tree | 88ddac56c779586cf9c678588fdd69970585f372 /crates | |
parent | f5584668dba709a119f398de038b3f36085be5ff (diff) |
Try to find rustfmt in more places
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_toolchain/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/rust-analyzer/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 2 |
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 | ||
18 | pub 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" } | |||
41 | vfs = { path = "../vfs" } | 41 | vfs = { path = "../vfs" } |
42 | vfs-notify = { path = "../vfs-notify" } | 42 | vfs-notify = { path = "../vfs-notify" } |
43 | ra_cfg = { path = "../ra_cfg"} | 43 | ra_cfg = { path = "../ra_cfg"} |
44 | ra_toolchain = { path = "../ra_toolchain" } | ||
44 | 45 | ||
45 | # This should only be used in CLI | 46 | # This should only be used in CLI |
46 | ra_db = { path = "../ra_db" } | 47 | ra_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 |