Browse Source

Simplify parsing of feature flags

pull/4168/head
Philipp Kolberg 2 years ago
parent
commit
fe5b34b6ee
No known key found for this signature in database GPG Key ID: 4C58CB0448FF9061
  1. 8
      src/util.rs

8
src/util.rs

@ -751,13 +751,7 @@ pub fn convert_json_key_lcase_first(src_json: Value) -> Value {
/// Parses the experimental client feature flags string into a HashMap. /// Parses the experimental client feature flags string into a HashMap.
pub fn parse_experimental_client_feature_flags(experimental_client_feature_flags: &str) -> HashMap<String, bool> { pub fn parse_experimental_client_feature_flags(experimental_client_feature_flags: &str) -> HashMap<String, bool> {
let experimental_client_feature_flags_lowercase = experimental_client_feature_flags.to_lowercase(); let feature_states = experimental_client_feature_flags.to_lowercase().split(',').map(|f| (f.trim().to_owned(), true)).collect();
let features = experimental_client_feature_flags_lowercase.split(',').map(|f| f.trim()).collect::<Vec<_>>();
let mut feature_states: HashMap<String, bool> = HashMap::new();
for feature in features {
feature_states.insert(feature.to_string(), true);
}
feature_states feature_states
} }

Loading…
Cancel
Save