diff --git a/src/function.rs b/src/function.rs index d2932f0..445adf1 100644 --- a/src/function.rs +++ b/src/function.rs @@ -81,18 +81,15 @@ fn arch(_context: &FunctionContext) -> Result { } fn capitalize(_context: &FunctionContext, s: &str) -> Result { - Ok( - s.chars() - .enumerate() - .flat_map(|(i, c)| { - if i == 0 { - c.to_uppercase().collect::>() - } else { - c.to_lowercase().collect::>() - } - }) - .collect(), - ) + let mut capitalized = String::new(); + for (i, c) in s.chars().enumerate() { + if i == 0 { + capitalized.extend(c.to_uppercase()); + } else { + capitalized.extend(c.to_lowercase()); + } + } + Ok(capitalized) } fn clean(_context: &FunctionContext, path: &str) -> Result {