Skip to content

Commit 9f4934e

Browse files
committed
Clarify that Cow::into_owned returns owned data
1 parent 6421a49 commit 9f4934e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/alloc/src/borrow.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,7 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
292292
///
293293
/// # Examples
294294
///
295-
/// Calling `into_owned` on a `Cow::Borrowed` clones the underlying data
296-
/// and becomes a `Cow::Owned`:
295+
/// Calling `into_owned` on a `Cow::Borrowed` returns a clone of the borrowed data:
297296
///
298297
/// ```
299298
/// use std::borrow::Cow;
@@ -307,7 +306,8 @@ impl<B: ?Sized + ToOwned> Cow<'_, B> {
307306
/// );
308307
/// ```
309308
///
310-
/// Calling `into_owned` on a `Cow::Owned` is a no-op:
309+
/// Calling `into_owned` on a `Cow::Owned` returns the owned data. The data is moved out of the
310+
/// `Cow` without being cloned.
311311
///
312312
/// ```
313313
/// use std::borrow::Cow;

0 commit comments

Comments
 (0)