diff options
| author | Lukas Wirth <lukastw97@gmail.com> | 2025-01-03 12:43:43 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-03 12:43:43 +0000 |
| commit | 31b45b034104f58e2a5760ac28f84f844a96b99a (patch) | |
| tree | bb5e7257c1282b0425f784a9eda0c0f3499ddce6 /src/tools/rust-analyzer | |
| parent | 2e7d94bab1ae04e9bc73194c1c653574c5870a28 (diff) | |
| parent | 40b37ee177f9a4b0e1225aefa735a5ebd2c5705d (diff) | |
| download | rust-31b45b034104f58e2a5760ac28f84f844a96b99a.tar.gz rust-31b45b034104f58e2a5760ac28f84f844a96b99a.zip | |
Merge pull request #18827 from Veykril/push-zqsplmtwsxxk
minor: Honor `CARGO_TARGET_DIR` for cargo target dir config
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs index fd2219c5026..f054bde903d 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs @@ -2126,7 +2126,10 @@ impl Config { fn target_dir_from_config(&self, source_root: Option<SourceRootId>) -> Option<Utf8PathBuf> { self.cargo_targetDir(source_root).as_ref().and_then(|target_dir| match target_dir { TargetDirectory::UseSubdirectory(true) => { - Some(Utf8PathBuf::from("target/rust-analyzer")) + let env_var = env::var("CARGO_TARGET_DIR").ok(); + let mut path = Utf8PathBuf::from(env_var.as_deref().unwrap_or("target")); + path.push("rust-analyzer"); + Some(path) } TargetDirectory::UseSubdirectory(false) => None, TargetDirectory::Directory(dir) => Some(dir.clone()), |
