mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Simplify cfg representation
This commit is contained in:
parent
20d369a826
commit
2bc4c1ff31
3 changed files with 41 additions and 31 deletions
|
@ -1,6 +1,6 @@
|
|||
//! See `CargoTargetSpec`
|
||||
|
||||
use cfg::CfgExpr;
|
||||
use cfg::{CfgAtom, CfgExpr};
|
||||
use ide::{FileId, RunnableKind, TestId};
|
||||
use project_model::{self, TargetKind};
|
||||
use vfs::AbsPathBuf;
|
||||
|
@ -160,7 +160,9 @@ impl CargoTargetSpec {
|
|||
/// Fill minimal features needed
|
||||
fn required_features(cfg_expr: &CfgExpr, features: &mut Vec<String>) {
|
||||
match cfg_expr {
|
||||
CfgExpr::KeyValue { key, value } if key == "feature" => features.push(value.to_string()),
|
||||
CfgExpr::Atom(CfgAtom::KeyValue { key, value }) if key == "feature" => {
|
||||
features.push(value.to_string())
|
||||
}
|
||||
CfgExpr::All(preds) => {
|
||||
preds.iter().for_each(|cfg| required_features(cfg, features));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue