Unnamed repository; edit this file 'description' to name the repository.
Addressed PR style comments
Victor Song 2023-10-09
parent 9771e1e · commit a39d207
-rw-r--r--crates/rust-analyzer/src/config.rs21
-rw-r--r--docs/user/generated_config.adoc3
-rw-r--r--editors/code/package.json2
3 files changed, 12 insertions, 14 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 39a98bcd29..c8df4255d9 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -481,7 +481,8 @@ config_data! {
runnables_extraArgs: Vec<String> = "[]",
/// Optional path to a rust-analyzer specific target directory.
- /// This is useful to prevent rust-analyzer's `cargo check` from blocking builds.
+ /// This prevents rust-analyzer's `cargo check` from locking the `Cargo.lock`
+ /// at the expense of duplicating build artifacts.
///
/// Set to `true` to use a subdirectory of the existing target directory or
/// set to a path relative to the workspace to use that path.
@@ -1349,17 +1350,13 @@ impl Config {
}
fn target_dir_from_config(&self) -> Option<PathBuf> {
- self.data
- .rust_analyzerTargetDir
- .as_ref()
- .map(|target_dir| match target_dir {
- TargetDirectory::UseSubdirectory(yes) if *yes => {
- Some(PathBuf::from("target/rust-analyzer"))
- }
- TargetDirectory::UseSubdirectory(_) => None,
- TargetDirectory::Directory(dir) => Some(dir.clone()),
- })
- .flatten()
+ self.data.rust_analyzerTargetDir.as_ref().and_then(|target_dir| match target_dir {
+ TargetDirectory::UseSubdirectory(yes) if *yes => {
+ Some(PathBuf::from("target/rust-analyzer"))
+ }
+ TargetDirectory::UseSubdirectory(_) => None,
+ TargetDirectory::Directory(dir) => Some(dir.clone()),
+ })
}
pub fn check_on_save(&self) -> bool {
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index 4440caaed8..7c76ae81be 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -761,7 +761,8 @@ tests or binaries. For example, it may be `--release`.
+
--
Optional path to a rust-analyzer specific target directory.
-This is useful to prevent rust-analyzer's `cargo check` from blocking builds.
+This prevents rust-analyzer's `cargo check` from locking the `Cargo.lock`
+at the expense of duplicating build artifacts.
Set to `true` to use a subdirectory of the existing target directory or
set to a path relative to the workspace to use that path.
diff --git a/editors/code/package.json b/editors/code/package.json
index a18acb9830..fc6597a0d4 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -1489,7 +1489,7 @@
}
},
"rust-analyzer.rust.analyzerTargetDir": {
- "markdownDescription": "Optional path to a rust-analyzer specific target directory.\nThis is useful to prevent rust-analyzer's `cargo check` from blocking builds.\n\nSet to `true` to use a subdirectory of the existing target directory or\nset to a path relative to the workspace to use that path.",
+ "markdownDescription": "Optional path to a rust-analyzer specific target directory.\nThis prevents rust-analyzer's `cargo check` from locking the `Cargo.lock`\nat the expense of duplicating build artifacts.\n\nSet to `true` to use a subdirectory of the existing target directory or\nset to a path relative to the workspace to use that path.",
"default": null,
"anyOf": [
{