Update iterator sol in quiz2.rs

This commit is contained in:
NitinKM 2024-07-07 23:19:38 +05:30 committed by GitHub
parent 9d7b973a62
commit 5372caefb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()
}