From 2458d41eb312c6f3478c6b374aef79ee086727f3 Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com> Date: Sun, 8 Dec 2024 08:22:20 +0900 Subject: [PATCH] refactor: rename args --- src/yaml_expand.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/yaml_expand.rs b/src/yaml_expand.rs index 2e008256b..c6550a5ab 100644 --- a/src/yaml_expand.rs +++ b/src/yaml_expand.rs @@ -44,8 +44,8 @@ fn process_value( pub fn process_yaml( yaml: &Yaml, replacements: &HashMap>, - expand_found: &mut u128, - expand_enabled: &mut u128, + expand_count: &mut u128, + expand_enabled_count: &mut u128, ) -> Yaml { match yaml { Yaml::Hash(hash) => { @@ -53,25 +53,29 @@ pub fn process_yaml( for (key, value) in hash { if let Yaml::String(key_str) = key { if key_str.contains("|expand") { - *expand_found += 1; + *expand_count += 1; let new_key = key_str.replace("|expand", ""); let org_value = value.clone(); - let new_value = - process_value(&org_value, replacements, expand_found, expand_enabled); + let new_value = process_value( + &org_value, + replacements, + expand_count, + expand_enabled_count, + ); if org_value != new_value { - *expand_enabled += 1; + *expand_enabled_count += 1; }; new_hash.insert(Yaml::String(new_key), new_value); } else { new_hash.insert( key.clone(), - process_yaml(value, replacements, expand_found, expand_enabled), + process_yaml(value, replacements, expand_count, expand_enabled_count), ); } } else { new_hash.insert( key.clone(), - process_yaml(value, replacements, expand_found, expand_enabled), + process_yaml(value, replacements, expand_count, expand_enabled_count), ); } } @@ -80,7 +84,7 @@ pub fn process_yaml( Yaml::Array(array) => { let new_array: Vec = array .iter() - .map(|item| process_yaml(item, replacements, expand_found, expand_enabled)) + .map(|item| process_yaml(item, replacements, expand_count, expand_enabled_count)) .collect(); Yaml::Array(new_array) }