Explorar el Código

fix(cli): inject config feature flags when features arg is not provided

Lucas Nogueira hace 2 años
padre
commit
1ecaeb29aa
Se han modificado 2 ficheros con 10 adiciones y 3 borrados
  1. 6 0
      .changes/fix-config-features.md
  2. 4 3
      tooling/cli/src/build.rs

+ 6 - 0
.changes/fix-config-features.md

@@ -0,0 +1,6 @@
+---
+"cli.rs": patch
+"cli.js": patch
+---
+
+Fixes injection of Cargo features defined in the configuration file.

+ 4 - 3
tooling/cli/src/build.rs

@@ -157,9 +157,10 @@ pub fn command(mut options: Options) -> Result<()> {
     options.runner = config_.build.runner.clone();
   }
 
-  if let Some(list) = options.features.as_mut() {
-    list.extend(config_.build.features.clone().unwrap_or_default());
-  }
+  options
+    .features
+    .get_or_insert(Vec::new())
+    .extend(config_.build.features.clone().unwrap_or_default());
 
   let bin_path = app_settings.app_binary_path(&interface_options)?;
   let out_dir = bin_path.parent().unwrap();