We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2e7d94b + 40b37ee commit 31b45b0Copy full SHA for 31b45b0
src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
@@ -2126,7 +2126,10 @@ impl Config {
2126
fn target_dir_from_config(&self, source_root: Option<SourceRootId>) -> Option<Utf8PathBuf> {
2127
self.cargo_targetDir(source_root).as_ref().and_then(|target_dir| match target_dir {
2128
TargetDirectory::UseSubdirectory(true) => {
2129
- Some(Utf8PathBuf::from("target/rust-analyzer"))
+ let env_var = env::var("CARGO_TARGET_DIR").ok();
2130
+ let mut path = Utf8PathBuf::from(env_var.as_deref().unwrap_or("target"));
2131
+ path.push("rust-analyzer");
2132
+ Some(path)
2133
}
2134
TargetDirectory::UseSubdirectory(false) => None,
2135
TargetDirectory::Directory(dir) => Some(dir.clone()),
0 commit comments