mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Implement rust-analyzer feature configuration to tests.
This commit is contained in:
parent
57ed622ec4
commit
eb75a644a1
2 changed files with 17 additions and 8 deletions
|
@ -21,6 +21,7 @@ pub(crate) struct CargoTargetSpec {
|
||||||
|
|
||||||
impl CargoTargetSpec {
|
impl CargoTargetSpec {
|
||||||
pub(crate) fn runnable_args(
|
pub(crate) fn runnable_args(
|
||||||
|
snap: &GlobalStateSnapshot,
|
||||||
spec: Option<CargoTargetSpec>,
|
spec: Option<CargoTargetSpec>,
|
||||||
kind: &RunnableKind,
|
kind: &RunnableKind,
|
||||||
cfgs: &[CfgExpr],
|
cfgs: &[CfgExpr],
|
||||||
|
@ -78,13 +79,21 @@ impl CargoTargetSpec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut features = Vec::new();
|
if snap.config.cargo.all_features {
|
||||||
for cfg in cfgs {
|
args.push("--all-features".to_string());
|
||||||
required_features(cfg, &mut features);
|
} else {
|
||||||
}
|
let mut features = Vec::new();
|
||||||
for feature in features {
|
for cfg in cfgs {
|
||||||
args.push("--features".to_string());
|
required_features(cfg, &mut features);
|
||||||
args.push(feature);
|
}
|
||||||
|
for feature in &snap.config.cargo.features {
|
||||||
|
features.push(feature.clone());
|
||||||
|
}
|
||||||
|
features.dedup();
|
||||||
|
for feature in features {
|
||||||
|
args.push("--features".to_string());
|
||||||
|
args.push(feature);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((args, extra_args))
|
Ok((args, extra_args))
|
||||||
|
|
|
@ -666,7 +666,7 @@ pub(crate) fn runnable(
|
||||||
let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone());
|
let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone());
|
||||||
let target = spec.as_ref().map(|s| s.target.clone());
|
let target = spec.as_ref().map(|s| s.target.clone());
|
||||||
let (cargo_args, executable_args) =
|
let (cargo_args, executable_args) =
|
||||||
CargoTargetSpec::runnable_args(spec, &runnable.kind, &runnable.cfg_exprs)?;
|
CargoTargetSpec::runnable_args(snap, spec, &runnable.kind, &runnable.cfg_exprs)?;
|
||||||
let label = runnable.label(target);
|
let label = runnable.label(target);
|
||||||
let location = location_link(snap, None, runnable.nav)?;
|
let location = location_link(snap, None, runnable.nav)?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue