Merge pull request #2031 from NewtonChutney/patch-1

Update iterator solution in quiz2.rs
This commit is contained in:
Mo 2024-07-07 20:25:21 +02:00 committed by GitHub
commit 6469e9734b
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 { .map(|(mut string, command)| match command {
Command::Uppercase => string.to_uppercase(), Command::Uppercase => string.to_uppercase(),
Command::Trim => string.trim().to_string(), Command::Trim => string.trim().to_string(),
Command::Append(n) => { Command::Append(n) => string + &"bar".repeat(n),
for _ in 0..n {
string += "bar";
}
string
}
}) })
.collect() .collect()
} }