Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,7 @@ impl<T> Option<&T> {
/// let copied = opt_x.copied();
/// assert_eq!(copied, Some(12));
/// ```
#[inline]
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(feature = "copied", since = "1.35.0")]
#[rustc_const_unstable(feature = "const_option", issue = "67441")]
Expand Down Expand Up @@ -1884,6 +1885,7 @@ impl<T> Option<&T> {
/// let cloned = opt_x.cloned();
/// assert_eq!(cloned, Some(12));
/// ```
#[inline]
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn cloned(self) -> Option<T>
Expand All @@ -1910,6 +1912,7 @@ impl<T> Option<&mut T> {
/// let copied = opt_x.copied();
/// assert_eq!(copied, Some(12));
/// ```
#[inline]
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(feature = "copied", since = "1.35.0")]
#[rustc_const_unstable(feature = "const_option_ext", issue = "91930")]
Expand All @@ -1935,6 +1938,7 @@ impl<T> Option<&mut T> {
/// let cloned = opt_x.cloned();
/// assert_eq!(cloned, Some(12));
/// ```
#[inline]
#[must_use = "`self` will be dropped if the result is not used"]
#[stable(since = "1.26.0", feature = "option_ref_mut_cloned")]
pub fn cloned(self) -> Option<T>
Expand Down