mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
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 <clemens.wasser@gmail.com>
This commit is contained in:
commit
6b7cb8b5ab
4 changed files with 41 additions and 14 deletions
|
@ -144,12 +144,15 @@ impl CargoWorkspace {
|
|||
meta.manifest_path(cargo_toml.to_path_buf());
|
||||
if cargo_features.all_features {
|
||||
meta.features(CargoOpt::AllFeatures);
|
||||
} else if cargo_features.no_default_features {
|
||||
// FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures`
|
||||
// https://github.com/oli-obk/cargo_metadata/issues/79
|
||||
meta.features(CargoOpt::NoDefaultFeatures);
|
||||
} else if !cargo_features.features.is_empty() {
|
||||
meta.features(CargoOpt::SomeFeatures(cargo_features.features.clone()));
|
||||
} else {
|
||||
if cargo_features.no_default_features {
|
||||
// FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures`
|
||||
// https://github.com/oli-obk/cargo_metadata/issues/79
|
||||
meta.features(CargoOpt::NoDefaultFeatures);
|
||||
}
|
||||
if !cargo_features.features.is_empty() {
|
||||
meta.features(CargoOpt::SomeFeatures(cargo_features.features.clone()));
|
||||
}
|
||||
}
|
||||
if let Some(parent) = cargo_toml.parent() {
|
||||
meta.current_dir(parent.to_path_buf());
|
||||
|
@ -289,12 +292,16 @@ pub fn load_extern_resources(
|
|||
cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml);
|
||||
if cargo_features.all_features {
|
||||
cmd.arg("--all-features");
|
||||
} else if cargo_features.no_default_features {
|
||||
// FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures`
|
||||
// https://github.com/oli-obk/cargo_metadata/issues/79
|
||||
cmd.arg("--no-default-features");
|
||||
} else {
|
||||
cmd.args(&cargo_features.features);
|
||||
if cargo_features.no_default_features {
|
||||
// FIXME: `NoDefaultFeatures` is mutual exclusive with `SomeFeatures`
|
||||
// https://github.com/oli-obk/cargo_metadata/issues/79
|
||||
cmd.arg("--no-default-features");
|
||||
}
|
||||
if !cargo_features.features.is_empty() {
|
||||
cmd.arg("--features");
|
||||
cmd.arg(cargo_features.features.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
let output = cmd.output()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue