Skip to content

Commit 58f318f

Browse files
committed
Flip default features config
1 parent 1c21b14 commit 58f318f

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ config_data! {
6767
/// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
6868
/// avoid compiling unnecessary things.
6969
cargo_buildScripts_useRustcWrapper: bool = "true",
70+
/// Do not activate the `default` feature.
71+
cargo_defaultFeatures: bool = "true",
7072
/// List of features to activate. Set to `"all"` to pass `--all-features` to cargo.
7173
cargo_features: CargoFeatures = "[]",
72-
/// Do not activate the `default` feature.
73-
cargo_noDefaultFeatures: bool = "false",
7474
/// Internal config for debugging, disables loading of sysroot crates.
7575
cargo_noSysroot: bool = "false",
7676
/// Compilation target override (target triple).
@@ -82,15 +82,15 @@ config_data! {
8282
checkOnSave_allTargets: bool = "true",
8383
/// Cargo command to use for `cargo check`.
8484
checkOnSave_command: String = "\"check\"",
85+
/// Do not activate the `default` feature.
86+
checkOnSave_defaultFeatures: Option<bool> = "null",
8587
/// Run specified `cargo check` command for diagnostics on save.
8688
checkOnSave_enable: bool = "true",
8789
/// Extra arguments for `cargo check`.
8890
checkOnSave_extraArgs: Vec<String> = "[]",
8991
/// List of features to activate. Defaults to
9092
/// `#rust-analyzer.cargo.features#`. Set to `"all"` to pass `--all-features` to cargo.
9193
checkOnSave_features: Option<CargoFeatures> = "null",
92-
/// Do not activate the `default` feature.
93-
checkOnSave_noDefaultFeatures: Option<bool> = "null",
9494
/// Advanced option, fully override the command rust-analyzer uses for
9595
/// checking. The command should include `--message-format=json` or
9696
/// similar option.
@@ -877,7 +877,7 @@ impl Config {
877877
});
878878

879879
CargoConfig {
880-
no_default_features: self.data.cargo_noDefaultFeatures,
880+
no_default_features: !self.data.cargo_defaultFeatures,
881881
all_features: matches!(self.data.cargo_features, CargoFeatures::All),
882882
features: match &self.data.cargo_features {
883883
CargoFeatures::All => vec![],
@@ -924,10 +924,10 @@ impl Config {
924924
.clone()
925925
.or_else(|| self.data.cargo_target.clone()),
926926
all_targets: self.data.checkOnSave_allTargets,
927-
no_default_features: self
927+
no_default_features: !self
928928
.data
929-
.checkOnSave_noDefaultFeatures
930-
.unwrap_or(self.data.cargo_noDefaultFeatures),
929+
.checkOnSave_defaultFeatures
930+
.unwrap_or(self.data.cargo_defaultFeatures),
931931
all_features: matches!(
932932
self.data.checkOnSave_features.as_ref().unwrap_or(&self.data.cargo_features),
933933
CargoFeatures::All

docs/user/generated_config.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ include `--message-format=json` or a similar option.
2727
Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
2828
avoid compiling unnecessary things.
2929
--
30-
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
30+
[[rust-analyzer.cargo.defaultFeatures]]rust-analyzer.cargo.defaultFeatures (default: `true`)::
3131
+
3232
--
33-
List of features to activate. Set to `"all"` to pass `--all-features` to cargo.
33+
Do not activate the `default` feature.
3434
--
35-
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
35+
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
3636
+
3737
--
38-
Do not activate the `default` feature.
38+
List of features to activate. Set to `"all"` to pass `--all-features` to cargo.
3939
--
4040
[[rust-analyzer.cargo.noSysroot]]rust-analyzer.cargo.noSysroot (default: `false`)::
4141
+
@@ -62,6 +62,11 @@ Check all targets and tests (`--all-targets`).
6262
--
6363
Cargo command to use for `cargo check`.
6464
--
65+
[[rust-analyzer.checkOnSave.defaultFeatures]]rust-analyzer.checkOnSave.defaultFeatures (default: `null`)::
66+
+
67+
--
68+
Do not activate the `default` feature.
69+
--
6570
[[rust-analyzer.checkOnSave.enable]]rust-analyzer.checkOnSave.enable (default: `true`)::
6671
+
6772
--
@@ -78,11 +83,6 @@ Extra arguments for `cargo check`.
7883
List of features to activate. Defaults to
7984
`#rust-analyzer.cargo.features#`. Set to `"all"` to pass `--all-features` to cargo.
8085
--
81-
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
82-
+
83-
--
84-
Do not activate the `default` feature.
85-
--
8686
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
8787
+
8888
--

editors/code/package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@
407407
"default": true,
408408
"type": "boolean"
409409
},
410+
"rust-analyzer.cargo.defaultFeatures": {
411+
"markdownDescription": "Do not activate the `default` feature.",
412+
"default": true,
413+
"type": "boolean"
414+
},
410415
"rust-analyzer.cargo.features": {
411416
"markdownDescription": "List of features to activate. Set to `\"all\"` to pass `--all-features` to cargo.",
412417
"default": [],
@@ -424,11 +429,6 @@
424429
"Pass `--all-features` to cargo"
425430
]
426431
},
427-
"rust-analyzer.cargo.noDefaultFeatures": {
428-
"markdownDescription": "Do not activate the `default` feature.",
429-
"default": false,
430-
"type": "boolean"
431-
},
432432
"rust-analyzer.cargo.noSysroot": {
433433
"markdownDescription": "Internal config for debugging, disables loading of sysroot crates.",
434434
"default": false,
@@ -462,6 +462,14 @@
462462
"default": "check",
463463
"type": "string"
464464
},
465+
"rust-analyzer.checkOnSave.defaultFeatures": {
466+
"markdownDescription": "Do not activate the `default` feature.",
467+
"default": null,
468+
"type": [
469+
"null",
470+
"boolean"
471+
]
472+
},
465473
"rust-analyzer.checkOnSave.enable": {
466474
"markdownDescription": "Run specified `cargo check` command for diagnostics on save.",
467475
"default": true,
@@ -493,14 +501,6 @@
493501
"Pass `--all-features` to cargo"
494502
]
495503
},
496-
"rust-analyzer.checkOnSave.noDefaultFeatures": {
497-
"markdownDescription": "Do not activate the `default` feature.",
498-
"default": null,
499-
"type": [
500-
"null",
501-
"boolean"
502-
]
503-
},
504504
"rust-analyzer.checkOnSave.overrideCommand": {
505505
"markdownDescription": "Advanced option, fully override the command rust-analyzer uses for\nchecking. The command should include `--message-format=json` or\nsimilar option.",
506506
"default": null,

0 commit comments

Comments
 (0)