diff --git a/cli/args/mod.rs b/cli/args/mod.rs index d6ecafd46c..08746d294e 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -1030,19 +1030,20 @@ impl CliOptions { || self.workspace().has_unstable("sloppy-imports") } - pub fn unstable_features(&self) -> Vec { + pub fn unstable_features(&self) -> Vec<&str> { let from_config_file = self.workspace().unstable_features(); let unstable_features = from_config_file .iter() + .map(|s| s.as_str()) .chain( self .flags .unstable_config .features .iter() - .filter(|f| !from_config_file.contains(f)), + .filter(|f| !from_config_file.contains(f)) + .map(|s| s.as_str()), ) - .map(|f| f.to_owned()) .collect::>(); if !unstable_features.is_empty() { @@ -1055,9 +1056,7 @@ impl CliOptions { // check and warn if the unstable flag of config file isn't supported, by // iterating through the vector holding the unstable flags for unstable_value_from_config_file in &unstable_features { - if !all_valid_unstable_flags - .contains(&unstable_value_from_config_file.as_str()) - { + if !all_valid_unstable_flags.contains(unstable_value_from_config_file) { log::warn!( "{} '{}' isn't a valid unstable feature", colors::yellow("Warning"), diff --git a/cli/factory.rs b/cli/factory.rs index cf3bac96b8..2299b7e0ab 100644 --- a/cli/factory.rs +++ b/cli/factory.rs @@ -944,7 +944,7 @@ impl CliFactory { checker.set_exit_cb(Box::new(crate::unstable_exit_cb)); let unstable_features = cli_options.unstable_features(); for feature in deno_runtime::UNSTABLE_FEATURES { - if unstable_features.contains(&feature.name.to_string()) { + if unstable_features.contains(&feature.name) { checker.enable_feature(feature.name); } } diff --git a/cli/standalone/binary.rs b/cli/standalone/binary.rs index cacd6169ae..ae9a9b27bc 100644 --- a/cli/standalone/binary.rs +++ b/cli/standalone/binary.rs @@ -712,7 +712,12 @@ impl<'a> DenoCompileBinaryWriter<'a> { subdomain_wildcards: self.cli_options.unstable_subdomain_wildcards(), bare_node_builtins: self.cli_options.unstable_bare_node_builtins(), detect_cjs: self.cli_options.unstable_detect_cjs(), - features: self.cli_options.unstable_features(), + features: self + .cli_options + .unstable_features() + .into_iter() + .map(|s| s.to_string()) + .collect(), lazy_dynamic_imports: self.cli_options.unstable_lazy_dynamic_imports(), npm_lazy_caching: self.cli_options.unstable_npm_lazy_caching(), sloppy_imports: self.cli_options.unstable_sloppy_imports(),