mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-01 08:19:18 +00:00
docs: clarify comment in owned_mutation test (fix #2303)
This commit is contained in:
parent
f80fbca12e
commit
0f44350f32
@ -57,9 +57,9 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn owned_mutation() {
|
fn owned_mutation() {
|
||||||
// Of course this is also the case if a mutation does occur (not all
|
// When the data is already owned, even if a mutation occurs, `to_mut()`
|
||||||
// numbers are absolute). In this case, the call to `to_mut()` in the
|
// simply returns a mutable reference to the existing owned data without
|
||||||
// `abs_all` function returns a reference to the same data as before.
|
// performing any clone.
|
||||||
let vec = vec![-1, 0, 1];
|
let vec = vec![-1, 0, 1];
|
||||||
let mut input = Cow::from(vec);
|
let mut input = Cow::from(vec);
|
||||||
abs_all(&mut input);
|
abs_all(&mut input);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user