diff options
author | Craig Disselkoen <[email protected]> | 2020-05-05 22:07:10 +0100 |
---|---|---|
committer | Craig Disselkoen <[email protected]> | 2020-05-06 00:12:56 +0100 |
commit | 303b444dbb66019fc916dd350e54f7675aa3007f (patch) | |
tree | 163086a232e07ed91452122da5346383adaca58f /crates/ra_flycheck/src/lib.rs | |
parent | 5aa1bba107ef434e61c3136120b9478a307d67a9 (diff) |
pull function out into new crate ra_env; use in ra_flycheck as well
Diffstat (limited to 'crates/ra_flycheck/src/lib.rs')
-rw-r--r-- | crates/ra_flycheck/src/lib.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs index f27252949..d8b727b0e 100644 --- a/crates/ra_flycheck/src/lib.rs +++ b/crates/ra_flycheck/src/lib.rs | |||
@@ -4,7 +4,6 @@ | |||
4 | mod conv; | 4 | mod conv; |
5 | 5 | ||
6 | use std::{ | 6 | use std::{ |
7 | env, | ||
8 | io::{self, BufRead, BufReader}, | 7 | io::{self, BufRead, BufReader}, |
9 | path::PathBuf, | 8 | path::PathBuf, |
10 | process::{Command, Stdio}, | 9 | process::{Command, Stdio}, |
@@ -17,6 +16,7 @@ use lsp_types::{ | |||
17 | CodeAction, CodeActionOrCommand, Diagnostic, Url, WorkDoneProgress, WorkDoneProgressBegin, | 16 | CodeAction, CodeActionOrCommand, Diagnostic, Url, WorkDoneProgress, WorkDoneProgressBegin, |
18 | WorkDoneProgressEnd, WorkDoneProgressReport, | 17 | WorkDoneProgressEnd, WorkDoneProgressReport, |
19 | }; | 18 | }; |
19 | use ra_env::get_path_for_executable; | ||
20 | 20 | ||
21 | use crate::conv::{map_rust_diagnostic_to_lsp, MappedRustDiagnostic}; | 21 | use crate::conv::{map_rust_diagnostic_to_lsp, MappedRustDiagnostic}; |
22 | 22 | ||
@@ -216,7 +216,7 @@ impl FlycheckThread { | |||
216 | 216 | ||
217 | let mut cmd = match &self.config { | 217 | let mut cmd = match &self.config { |
218 | FlycheckConfig::CargoCommand { command, all_targets, all_features, extra_args } => { | 218 | FlycheckConfig::CargoCommand { command, all_targets, all_features, extra_args } => { |
219 | let mut cmd = Command::new(cargo_binary()); | 219 | let mut cmd = Command::new(get_path_for_executable("cargo").unwrap()); |
220 | cmd.arg(command); | 220 | cmd.arg(command); |
221 | cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]); | 221 | cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]); |
222 | cmd.arg(self.workspace_root.join("Cargo.toml")); | 222 | cmd.arg(self.workspace_root.join("Cargo.toml")); |
@@ -337,7 +337,3 @@ fn run_cargo( | |||
337 | 337 | ||
338 | Ok(()) | 338 | Ok(()) |
339 | } | 339 | } |
340 | |||
341 | fn cargo_binary() -> String { | ||
342 | env::var("CARGO").unwrap_or_else(|_| "cargo".to_string()) | ||
343 | } | ||