mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 23:36:30 +00:00
chore: clarified cow owned_no_mutation comments
This commit is contained in:
parent
6d4a980b04
commit
c4627e7112
1 changed files with 2 additions and 1 deletions
|
@ -52,7 +52,8 @@ mod tests {
|
||||||
fn owned_no_mutation() -> Result<(), &'static str> {
|
fn owned_no_mutation() -> Result<(), &'static str> {
|
||||||
// We can also pass `slice` without `&` so Cow owns it directly.
|
// We can also pass `slice` without `&` so Cow owns it directly.
|
||||||
// In this case no mutation occurs and thus also no clone,
|
// In this case no mutation occurs and thus also no clone,
|
||||||
// but the result is still owned because it always was.
|
// but the result is still owned because it was never borrowed
|
||||||
|
// or mutated.
|
||||||
let slice = vec![0, 1, 2];
|
let slice = vec![0, 1, 2];
|
||||||
let mut input = Cow::from(slice);
|
let mut input = Cow::from(slice);
|
||||||
match abs_all(&mut input) {
|
match abs_all(&mut input) {
|
||||||
|
|
Loading…
Reference in a new issue