aboutsummaryrefslogtreecommitdiff
path: root/crates/flycheck/src
diff options
context:
space:
mode:
authorBrendan Cully <[email protected]>2021-05-13 03:50:52 +0100
committerBrendan Cully <[email protected]>2021-05-13 03:50:52 +0100
commitc4664609ed0f8b430285de99b4f7a8cc0ae655f5 (patch)
treef582688a7fd396b5f18cd215d08af12b1e9d4b51 /crates/flycheck/src
parent312f1fe20a6a0a8e69834c66f51b9abc9db5e0ce (diff)
Use package root as `cargo check` working directory
Cargo commands are affected by the `.cargo/config` files above their working directory. If cargo is invoked from above the directory holding `Cargo.toml`, it may not pick up important settings like registry replacements, causing it to behave differently or even fail. Most cargo invocations are currently setting their working directories to the directory containing `Cargo.toml`, but a couple of paths remain in which cargo is invoked from the default workspace root instead. This change fixes that, resolving some cargo check failures that I experienced in a multi-root workspace in which packages used different registries.
Diffstat (limited to 'crates/flycheck/src')
-rw-r--r--crates/flycheck/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs
index 1682d8bde..93cf6a3d6 100644
--- a/crates/flycheck/src/lib.rs
+++ b/crates/flycheck/src/lib.rs
@@ -215,6 +215,7 @@ impl FlycheckActor {
215 } => { 215 } => {
216 let mut cmd = Command::new(toolchain::cargo()); 216 let mut cmd = Command::new(toolchain::cargo());
217 cmd.arg(command); 217 cmd.arg(command);
218 cmd.current_dir(&self.workspace_root);
218 cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]) 219 cmd.args(&["--workspace", "--message-format=json", "--manifest-path"])
219 .arg(self.workspace_root.join("Cargo.toml")); 220 .arg(self.workspace_root.join("Cargo.toml"));
220 221