From 19b562b3459fc9dfae518ee0bd537dc70512c086 Mon Sep 17 00:00:00 2001 From: William Archbell Date: Wed, 27 May 2020 21:15:21 -0700 Subject: [PATCH] Filter empty features from command line. Allows cargo workspaces to function. --- src/cargo_shim/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cargo_shim/mod.rs b/src/cargo_shim/mod.rs index 07acc85..706b2ab 100644 --- a/src/cargo_shim/mod.rs +++ b/src/cargo_shim/mod.rs @@ -299,6 +299,12 @@ impl CargoProject { command.arg( "--all-features" ); } + let features = features + .iter() + .filter(|f| !f.is_empty()) + .cloned() + .collect::>(); + if !features.is_empty() { command.arg( "--features" ); command.arg( &features.join( " " ) ); @@ -697,8 +703,13 @@ impl BuildConfig { if self.enable_all_features { command.arg( "--all-features" ); } + + let features = self.features + .iter() + .filter(|f| !f.is_empty()) + .collect::>(); - if !self.features.is_empty() { + if !features.is_empty() { command.arg( "--features" ); command.arg( &self.features.join( " " ) ); }