Skip to content

Commit 7e941fe

Browse files
bors[bot]guigui64
andauthored
Merge #4328
4328: add the allFeatures flag (true by default) r=matklad a=guigui64 As discussed on zulip. Co-authored-by: guigui64 <guillaume.comte10@gmail.com>
2 parents d38741f + c226601 commit 7e941fe

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

crates/ra_flycheck/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub use crate::conv::url_from_path_with_drive_lowercasing;
2424

2525
#[derive(Clone, Debug, PartialEq, Eq)]
2626
pub enum FlycheckConfig {
27-
CargoCommand { command: String, all_targets: bool, extra_args: Vec<String> },
27+
CargoCommand { command: String, all_targets: bool, all_features: bool, extra_args: Vec<String> },
2828
CustomCommand { command: String, args: Vec<String> },
2929
}
3030

@@ -215,14 +215,17 @@ impl FlycheckThread {
215215
self.check_process = None;
216216

217217
let mut cmd = match &self.config {
218-
FlycheckConfig::CargoCommand { command, all_targets, extra_args } => {
218+
FlycheckConfig::CargoCommand { command, all_targets, all_features, extra_args } => {
219219
let mut cmd = Command::new(cargo_binary());
220220
cmd.arg(command);
221221
cmd.args(&["--workspace", "--message-format=json", "--manifest-path"]);
222222
cmd.arg(self.workspace_root.join("Cargo.toml"));
223223
if *all_targets {
224224
cmd.arg("--all-targets");
225225
}
226+
if *all_features {
227+
cmd.arg("--all-features");
228+
}
226229
cmd.args(extra_args);
227230
cmd
228231
}

crates/rust-analyzer/src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ impl Default for Config {
8989
check: Some(FlycheckConfig::CargoCommand {
9090
command: "check".to_string(),
9191
all_targets: true,
92+
all_features: true,
9293
extra_args: Vec::new(),
9394
}),
9495

@@ -173,12 +174,13 @@ impl Config {
173174
}
174175
// otherwise configure command customizations
175176
_ => {
176-
if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets })
177+
if let Some(FlycheckConfig::CargoCommand { command, extra_args, all_targets, all_features })
177178
= &mut self.check
178179
{
179180
set(value, "/checkOnSave/extraArgs", extra_args);
180181
set(value, "/checkOnSave/command", command);
181182
set(value, "/checkOnSave/allTargets", all_targets);
183+
set(value, "/checkOnSave/allFeatures", all_features);
182184
}
183185
}
184186
};

editors/code/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@
296296
"default": true,
297297
"markdownDescription": "Check all targets and tests (will be passed as `--all-targets`)"
298298
},
299+
"rust-analyzer.checkOnSave.allFeatures": {
300+
"type": "boolean",
301+
"default": true,
302+
"markdownDescription": "Check with all features (will be passed as `--all-features`)"
303+
},
299304
"rust-analyzer.inlayHints.typeHints": {
300305
"type": "boolean",
301306
"default": true,

0 commit comments

Comments
 (0)