From 8649f28cb3c11458bd8c6d6b2f9f881e75bb90e6 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Mar 2026 21:26:53 +0100 Subject: [PATCH] docs: clarify cow1 owned_mutation comment --- exercises/19_smart_pointers/cow1.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exercises/19_smart_pointers/cow1.rs b/exercises/19_smart_pointers/cow1.rs index 15665007..01fe7ba5 100644 --- a/exercises/19_smart_pointers/cow1.rs +++ b/exercises/19_smart_pointers/cow1.rs @@ -57,9 +57,10 @@ mod tests { #[test] fn owned_mutation() { - // Of course this is also the case if a mutation does occur (not all - // numbers are absolute). In this case, the call to `to_mut()` in the - // `abs_all` function returns a reference to the same data as before. + // This is also the case if a mutation does occur (not all numbers are + // absolute). Since `input` is already owned here, the call to + // `to_mut()` in `abs_all` returns a mutable reference to the existing + // owned data instead of cloning it. let vec = vec![-1, 0, 1]; let mut input = Cow::from(vec); abs_all(&mut input);