aboutsummaryrefslogtreecommitdiff
path: root/crates/rust-analyzer/src/cargo_target_spec.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-23 19:59:18 +0100
committerBenjamin Coenen <[email protected]>2020-05-23 19:59:18 +0100
commit48d7c61e26398fa33b94e0e4bd0d2d1697ed4921 (patch)
tree7d22388871a7f4cb261cf37148c31fea91772d63 /crates/rust-analyzer/src/cargo_target_spec.rs
parent43339058e32e8bb0d218390b9df5b5a68fe57ca7 (diff)
add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/rust-analyzer/src/cargo_target_spec.rs')
-rw-r--r--crates/rust-analyzer/src/cargo_target_spec.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs
index a2f85060b..441fb61df 100644
--- a/crates/rust-analyzer/src/cargo_target_spec.rs
+++ b/crates/rust-analyzer/src/cargo_target_spec.rs
@@ -21,7 +21,7 @@ impl CargoTargetSpec {
21 pub(crate) fn runnable_args( 21 pub(crate) fn runnable_args(
22 spec: Option<CargoTargetSpec>, 22 spec: Option<CargoTargetSpec>,
23 kind: &RunnableKind, 23 kind: &RunnableKind,
24 features_needed: &Option<Vec<SmolStr>>, 24 features_needed: &Vec<SmolStr>,
25 ) -> Result<(Vec<String>, Vec<String>)> { 25 ) -> Result<(Vec<String>, Vec<String>)> {
26 let mut args = Vec::new(); 26 let mut args = Vec::new();
27 let mut extra_args = Vec::new(); 27 let mut extra_args = Vec::new();
@@ -76,12 +76,11 @@ impl CargoTargetSpec {
76 } 76 }
77 } 77 }
78 78
79 if let Some(features_needed) = features_needed { 79 features_needed.iter().for_each(|feature| {
80 features_needed.iter().for_each(|feature| { 80 args.push("--features".to_string());
81 args.push("--features".to_string()); 81 args.push(feature.to_string());
82 args.push(feature.to_string()); 82 });
83 }); 83
84 }
85 Ok((args, extra_args)) 84 Ok((args, extra_args))
86 } 85 }
87 86