aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/cargo_target_spec.rs
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/rust-analyzer/src/cargo_target_spec.rs
parent57ed622ec4f0f71a618f99a46aa0026e81eb2583 (diff)
Implement rust-analyzer feature configuration to tests.
Diffstat (limited to 'crates/rust-analyzer/src/cargo_target_spec.rs')
-rw-r--r--crates/rust-analyzer/src/cargo_target_spec.rs23
1 files changed, 16 insertions, 7 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))