Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/flycheck/src/lib.rs')
-rw-r--r--crates/flycheck/src/lib.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index c59aff2a8b..71ff3e7b0e 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -89,9 +89,10 @@ impl FlycheckHandle {
id: usize,
sender: Box<dyn Fn(Message) + Send>,
config: FlycheckConfig,
+ cargo: PathBuf,
workspace_root: AbsPathBuf,
) -> FlycheckHandle {
- let actor = FlycheckActor::new(id, sender, config, workspace_root);
+ let actor = FlycheckActor::new(id, sender, config, cargo, workspace_root);
let (sender, receiver) = unbounded::<StateChange>();
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
.name("Flycheck".to_owned())
@@ -171,6 +172,7 @@ struct FlycheckActor {
/// Either the workspace root of the workspace we are flychecking,
/// or the project root of the project.
root: AbsPathBuf,
+ cargo: PathBuf,
/// CargoHandle exists to wrap around the communication needed to be able to
/// run `cargo check` without blocking. Currently the Rust standard library
/// doesn't provide a way to read sub-process output without blocking, so we
@@ -189,10 +191,11 @@ impl FlycheckActor {
id: usize,
sender: Box<dyn Fn(Message) + Send>,
config: FlycheckConfig,
+ cargo: PathBuf,
workspace_root: AbsPathBuf,
) -> FlycheckActor {
tracing::info!(%id, ?workspace_root, "Spawning flycheck");
- FlycheckActor { id, sender, config, root: workspace_root, command_handle: None }
+ FlycheckActor { id, sender, config, cargo, root: workspace_root, command_handle: None }
}
fn report_progress(&self, progress: Progress) {
@@ -316,7 +319,7 @@ impl FlycheckActor {
ansi_color_output,
target_dir,
} => {
- let mut cmd = Command::new(toolchain::cargo());
+ let mut cmd = Command::new(&self.cargo);
cmd.arg(command);
cmd.current_dir(&self.root);