Skip to content

Commit

Permalink
Rollup merge of rust-lang#48787 - mbrubeck:cloned, r=joshtriplett
Browse files Browse the repository at this point in the history
Stabilize option_ref_mut_cloned

Closes rust-lang#43738.
  • Loading branch information
alexcrichton committed Mar 7, 2018
2 parents 0e6df53 + d04362f commit 05ebc19
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,14 +829,13 @@ impl<'a, T: Clone> Option<&'a mut T> {
/// # Examples
///
/// ```
/// #![feature(option_ref_mut_cloned)]
/// let mut x = 12;
/// let opt_x = Some(&mut x);
/// assert_eq!(opt_x, Some(&mut 12));
/// let cloned = opt_x.cloned();
/// assert_eq!(cloned, Some(12));
/// ```
#[unstable(feature = "option_ref_mut_cloned", issue = "43738")]
#[stable(since = "1.26.0", feature = "option_ref_mut_cloned")]
pub fn cloned(self) -> Option<T> {
self.map(|t| t.clone())
}
Expand Down

0 comments on commit 05ebc19

Please sign in to comment.