diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-30 22:23:41 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-30 22:23:41 +0100 |
commit | 6b7cb8b5ab539fc4333ce34bc29bf77c976f232a (patch) | |
tree | aacfaafe346349d6cb34371b0cdc0ec780c3085e /crates/flycheck | |
parent | 7d18109af47dfe993bcb1122c051ef96da63561b (diff) | |
parent | 2e562c158fd43d105c0c3f035aafe24c0e648b1e (diff) |
Merge #5596
5596: Add checkOnSave.noDefaultFeatures and correct, how we handle some cargo flags. r=clemenswasser a=clemenswasser
This PR adds the `rust-analyzer.checkOnSave.noDefaultFeatures` option
and fixes the handling of `cargo.allFeatures`, `cargo.noDefaultFeatures` and `cargo.features`.
Fixes: #5550
Co-authored-by: Clemens Wasser <[email protected]>
Diffstat (limited to 'crates/flycheck')
-rw-r--r-- | crates/flycheck/src/lib.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs index ad376ad18..7c38f5ef9 100644 --- a/crates/flycheck/src/lib.rs +++ b/crates/flycheck/src/lib.rs | |||
@@ -24,6 +24,7 @@ pub enum FlycheckConfig { | |||
24 | command: String, | 24 | command: String, |
25 | target_triple: Option<String>, | 25 | target_triple: Option<String>, |
26 | all_targets: bool, | 26 | all_targets: bool, |
27 | no_default_features: bool, | ||
27 | all_features: bool, | 28 | all_features: bool, |
28 | features: Vec<String>, | 29 | features: Vec<String>, |
29 | extra_args: Vec<String>, | 30 | extra_args: Vec<String>, |
@@ -180,6 +181,7 @@ impl FlycheckActor { | |||
180 | FlycheckConfig::CargoCommand { | 181 | FlycheckConfig::CargoCommand { |
181 | command, | 182 | command, |
182 | target_triple, | 183 | target_triple, |
184 | no_default_features, | ||
183 | all_targets, | 185 | all_targets, |
184 | all_features, | 186 | all_features, |
185 | extra_args, | 187 | extra_args, |
@@ -198,9 +200,14 @@ impl FlycheckActor { | |||
198 | } | 200 | } |
199 | if *all_features { | 201 | if *all_features { |
200 | cmd.arg("--all-features"); | 202 | cmd.arg("--all-features"); |
201 | } else if !features.is_empty() { | 203 | } else { |
202 | cmd.arg("--features"); | 204 | if *no_default_features { |
203 | cmd.arg(features.join(" ")); | 205 | cmd.arg("--no-default-features"); |
206 | } | ||
207 | if !features.is_empty() { | ||
208 | cmd.arg("--features"); | ||
209 | cmd.arg(features.join(" ")); | ||
210 | } | ||
204 | } | 211 | } |
205 | cmd.args(extra_args); | 212 | cmd.args(extra_args); |
206 | cmd | 213 | cmd |