diff --git a/src/main.rs b/src/main.rs index fbb3a72..a8f98ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,17 +22,12 @@ fn main() { } pub fn parse_and_calc_humanreadable(mut input: String) -> String { - let should_add_back_equals = if let Some((i, _)) = input - .chars() - .enumerate() - .filter(|(_, c)| !matches!(c, ' ' | '&' | '\n')) - .find(|(_, c)| *c == '=') - { - input.remove(i); - true - } else { - false - }; + let should_add_back_equals = input + .find('=') + .inspect(|i| { + input.remove(*i); + }) + .is_some(); // no need to remove the characters here, // as we ignore the them in all other logic already