aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model/src
diff options
context:
space:
mode:
authorClemens Wasser <[email protected]>2020-07-30 15:23:07 +0100
committerClemens Wasser <[email protected]>2020-07-30 15:28:29 +0100
commit2e562c158fd43d105c0c3f035aafe24c0e648b1e (patch)
tree84337797d0bd3ab4851fcb36191fb54739b8e1c4 /crates/ra_project_model/src
parent8d9f8ac2739e7d02bcbc69e933682c2ef305f987 (diff)
ra_project_model: Fix configuration of features
This commit fixes the handling of user-defined configuration of some cargo options. Previously you could either specify `--all-features`, `--no-default-features` or `--features`. Now you can specify either `--all-features` or `--no-default-features` and `--features`. This commit also corrects the `--features` command-line argument creation inside of `load_extern_resources`.
Diffstat (limited to 'crates/ra_project_model/src')
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs29
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()?;