diff --git a/solutions/quizzes/quiz2.rs b/solutions/quizzes/quiz2.rs index 2f5cc050..be3f1597 100644 --- a/solutions/quizzes/quiz2.rs +++ b/solutions/quizzes/quiz2.rs @@ -52,12 +52,7 @@ mod my_module { .map(|(mut string, command)| match command { Command::Uppercase => string.to_uppercase(), Command::Trim => string.trim().to_string(), - Command::Append(n) => { - for _ in 0..n { - string += "bar"; - } - string - } + Command::Append(n) => string + &"bar".repeat(n), }) .collect() }