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/ra_project_model/src | |
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/ra_project_model/src')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index fb88e0f06..10513542e 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -144,12 +144,15 @@ impl CargoWorkspace { | |||
144 | meta.manifest_path(cargo_toml.to_path_buf()); | 144 | meta.manifest_path(cargo_toml.to_path_buf()); |
145 | if cargo_features.all_features { | 145 | if cargo_features.all_features { |
146 | meta.features(CargoOpt::AllFeatures); | 146 | meta.features(CargoOpt::AllFeatures); |
147 | } else if cargo_features.no_default_features { | 147 | } else { |
148 | // FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures` | 148 | if cargo_features.no_default_features { |
149 | // https://github.com/oli-obk/cargo_metadata/issues/79 | 149 | // FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures` |
150 | meta.features(CargoOpt::NoDefaultFeatures); | 150 | // https://github.com/oli-obk/cargo_metadata/issues/79 |
151 | } else if !cargo_features.features.is_empty() { | 151 | meta.features(CargoOpt::NoDefaultFeatures); |
152 | meta.features(CargoOpt::SomeFeatures(cargo_features.features.clone())); | 152 | } |
153 | if !cargo_features.features.is_empty() { | ||
154 | meta.features(CargoOpt::SomeFeatures(cargo_features.features.clone())); | ||
155 | } | ||
153 | } | 156 | } |
154 | if let Some(parent) = cargo_toml.parent() { | 157 | if let Some(parent) = cargo_toml.parent() { |
155 | meta.current_dir(parent.to_path_buf()); | 158 | meta.current_dir(parent.to_path_buf()); |
@@ -289,12 +292,16 @@ pub fn load_extern_resources( | |||
289 | cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); | 292 | cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); |
290 | if cargo_features.all_features { | 293 | if cargo_features.all_features { |
291 | cmd.arg("--all-features"); | 294 | cmd.arg("--all-features"); |
292 | } else if cargo_features.no_default_features { | ||
293 | // FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures` | ||
294 | // https://github.com/oli-obk/cargo_metadata/issues/79 | ||
295 | cmd.arg("--no-default-features"); | ||
296 | } else { | 295 | } else { |
297 | cmd.args(&cargo_features.features); | 296 | if cargo_features.no_default_features { |
297 | // FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures` | ||
298 | // https://github.com/oli-obk/cargo_metadata/issues/79 | ||
299 | cmd.arg("--no-default-features"); | ||
300 | } | ||
301 | if !cargo_features.features.is_empty() { | ||
302 | cmd.arg("--features"); | ||
303 | cmd.arg(cargo_features.features.join(" ")); | ||
304 | } | ||
298 | } | 305 | } |
299 | 306 | ||
300 | let output = cmd.output()?; | 307 | let output = cmd.output()?; |