aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authordaxpedda <[email protected]>2020-07-02 15:13:24 +0100
committerdaxpedda <[email protected]>2020-07-02 15:13:24 +0100
commiteb75a644a1c4483a74027d8936b3cfb9a02b0957 (patch)
tree45489f2de69c156ea9c48cc449327a86f11085b9 /crates
parent57ed622ec4f0f71a618f99a46aa0026e81eb2583 (diff)
Implement rust-analyzer feature configuration to tests.
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/cargo_target_spec.rs23
-rw-r--r--crates/rust-analyzer/src/to_proto.rs2
2 files changed, 17 insertions, 8 deletions
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs
index e4dd5d92d..929926cbc 100644
--- a/crates/rust-analyzer/src/cargo_target_spec.rs
+++ b/crates/rust-analyzer/src/cargo_target_spec.rs
@@ -21,6 +21,7 @@ pub(crate) struct CargoTargetSpec {
21 21
22impl CargoTargetSpec { 22impl CargoTargetSpec {
23 pub(crate) fn runnable_args( 23 pub(crate) fn runnable_args(
24 snap: &GlobalStateSnapshot,
24 spec: Option<CargoTargetSpec>, 25 spec: Option<CargoTargetSpec>,
25 kind: &RunnableKind, 26 kind: &RunnableKind,
26 cfgs: &[CfgExpr], 27 cfgs: &[CfgExpr],
@@ -78,13 +79,21 @@ impl CargoTargetSpec {
78 } 79 }
79 } 80 }
80 81
81 let mut features = Vec::new(); 82 if snap.config.cargo.all_features {
82 for cfg in cfgs { 83 args.push("--all-features".to_string());
83 required_features(cfg, &mut features); 84 } else {
84 } 85 let mut features = Vec::new();
85 for feature in features { 86 for cfg in cfgs {
86 args.push("--features".to_string()); 87 required_features(cfg, &mut features);
87 args.push(feature); 88 }
89 for feature in &snap.config.cargo.features {
90 features.push(feature.clone());
91 }
92 features.dedup();
93 for feature in features {
94 args.push("--features".to_string());
95 args.push(feature);
96 }
88 } 97 }
89 98
90 Ok((args, extra_args)) 99 Ok((args, extra_args))
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 95dd8e408..652a44694 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -666,7 +666,7 @@ pub(crate) fn runnable(
666 let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone()); 666 let workspace_root = spec.as_ref().map(|it| it.workspace_root.clone());
667 let target = spec.as_ref().map(|s| s.target.clone()); 667 let target = spec.as_ref().map(|s| s.target.clone());
668 let (cargo_args, executable_args) = 668 let (cargo_args, executable_args) =
669 CargoTargetSpec::runnable_args(spec, &runnable.kind, &runnable.cfg_exprs)?; 669 CargoTargetSpec::runnable_args(snap, spec, &runnable.kind, &runnable.cfg_exprs)?;
670 let label = runnable.label(target); 670 let label = runnable.label(target);
671 let location = location_link(snap, None, runnable.nav)?; 671 let location = location_link(snap, None, runnable.nav)?;
672 672