Skip to content

Commit

Permalink
Addressed PR style comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrubias committed Oct 9, 2023
1 parent 9771e1e commit a39d207
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
21 changes: 9 additions & 12 deletions crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion docs/user/generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down

0 comments on commit a39d207

Please sign in to comment.