diff options
| author | Jonathan Giddy <jongiddy@gmail.com> | 2022-03-23 13:01:00 +0000 |
|---|---|---|
| committer | Jonathan Giddy <jongiddy@gmail.com> | 2022-03-23 13:01:00 +0000 |
| commit | 9f4934ec19af7fe970fc1278973ec5763ea0312c (patch) | |
| tree | 0b99653edc268c23fb16c63977d1573b52d457b8 | |
| parent | 6421a499a50adbaa7b5d0234bdd4817d970f0933 (diff) | |
| download | rust-9f4934ec19af7fe970fc1278973ec5763ea0312c.tar.gz rust-9f4934ec19af7fe970fc1278973ec5763ea0312c.zip | |
Clarify that `Cow::into_owned` returns owned data
| -rw-r--r-- | library/alloc/src/borrow.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/alloc/src/borrow.rs b/library/alloc/src/borrow.rs index 63234ee91f0..2597c30e6b1 100644 --- a/library/alloc/src/borrow.rs +++ b/library/alloc/src/borrow.rs @@ -292,8 +292,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> { /// /// # Examples /// - /// Calling `into_owned` on a `Cow::Borrowed` clones the underlying data - /// and becomes a `Cow::Owned`: + /// Calling `into_owned` on a `Cow::Borrowed` returns a clone of the borrowed data: /// /// ``` /// use std::borrow::Cow; @@ -307,7 +306,8 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> { /// ); /// ``` /// - /// Calling `into_owned` on a `Cow::Owned` is a no-op: + /// Calling `into_owned` on a `Cow::Owned` returns the owned data. The data is moved out of the + /// `Cow` without being cloned. /// /// ``` /// use std::borrow::Cow; |
