Skip to content

Commit 6469e97

Browse files
authored
Merge pull request #2031 from NewtonChutney/patch-1
Update iterator solution in quiz2.rs
2 parents 9d7b973 + 5372cae commit 6469e97

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

solutions/quizzes/quiz2.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ mod my_module {
5252
.map(|(mut string, command)| match command {
5353
Command::Uppercase => string.to_uppercase(),
5454
Command::Trim => string.trim().to_string(),
55-
Command::Append(n) => {
56-
for _ in 0..n {
57-
string += "bar";
58-
}
59-
string
60-
}
55+
Command::Append(n) => string + &"bar".repeat(n),
6156
})
6257
.collect()
6358
}

0 commit comments

Comments
 (0)