diff options
author | Jade <[email protected]> | 2021-06-14 05:41:46 +0100 |
---|---|---|
committer | Jade <[email protected]> | 2021-06-19 09:09:19 +0100 |
commit | 8b77e2692cd97552b1b8d66eb51cec69695b3a5b (patch) | |
tree | 82187a911cd5e5acd8ce84f1f375d53185a05c7f /crates/rust-analyzer | |
parent | 1f6abb7fbae35dbd036032a6ea2a9e04307f1f55 (diff) |
Implement a config override for the default #[cfg(test)] in cargo crates
Fixes crates which vanish when the 'test' cfg atom is set.
Fix #7243.
Fix #9203.
Fix #7225.
Diffstat (limited to 'crates/rust-analyzer')
-rw-r--r-- | crates/rust-analyzer/src/config.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 16c295639..7e0276c10 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs | |||
@@ -55,6 +55,8 @@ config_data! { | |||
55 | cargo_autoreload: bool = "true", | 55 | cargo_autoreload: bool = "true", |
56 | /// Activate all available features (`--all-features`). | 56 | /// Activate all available features (`--all-features`). |
57 | cargo_allFeatures: bool = "false", | 57 | cargo_allFeatures: bool = "false", |
58 | /// Unsets `#[cfg(test)]` for the specified crates. | ||
59 | cargo_unsetTest: Vec<String> = "[\"core\"]", | ||
58 | /// List of features to activate. | 60 | /// List of features to activate. |
59 | cargo_features: Vec<String> = "[]", | 61 | cargo_features: Vec<String> = "[]", |
60 | /// Run build scripts (`build.rs`) for more precise code analysis. | 62 | /// Run build scripts (`build.rs`) for more precise code analysis. |
@@ -595,8 +597,10 @@ impl Config { | |||
595 | target: self.data.cargo_target.clone(), | 597 | target: self.data.cargo_target.clone(), |
596 | rustc_source, | 598 | rustc_source, |
597 | no_sysroot: self.data.cargo_noSysroot, | 599 | no_sysroot: self.data.cargo_noSysroot, |
600 | unset_test_crates: self.data.cargo_unsetTest.clone(), | ||
598 | } | 601 | } |
599 | } | 602 | } |
603 | |||
600 | pub fn rustfmt(&self) -> RustfmtConfig { | 604 | pub fn rustfmt(&self) -> RustfmtConfig { |
601 | match &self.data.rustfmt_overrideCommand { | 605 | match &self.data.rustfmt_overrideCommand { |
602 | Some(args) if !args.is_empty() => { | 606 | Some(args) if !args.is_empty() => { |