Stabilize Option::copied
closes https://github.com/rust-lang/rust/issues/57126
This commit is contained in:
parent
52e885628e
commit
08f264d576
2 changed files with 2 additions and 7 deletions
|
@ -881,15 +881,13 @@ impl<T: Copy> Option<&T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(copied)]
|
||||
///
|
||||
/// let x = 12;
|
||||
/// let opt_x = Some(&x);
|
||||
/// assert_eq!(opt_x, Some(&12));
|
||||
/// let copied = opt_x.copied();
|
||||
/// assert_eq!(copied, Some(12));
|
||||
/// ```
|
||||
#[unstable(feature = "copied", issue = "57126")]
|
||||
#[stable(feature = "copied", since = "1.35.0")]
|
||||
pub fn copied(self) -> Option<T> {
|
||||
self.map(|&t| t)
|
||||
}
|
||||
|
@ -902,15 +900,13 @@ impl<T: Copy> Option<&mut T> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(copied)]
|
||||
///
|
||||
/// let mut x = 12;
|
||||
/// let opt_x = Some(&mut x);
|
||||
/// assert_eq!(opt_x, Some(&mut 12));
|
||||
/// let copied = opt_x.copied();
|
||||
/// assert_eq!(copied, Some(12));
|
||||
/// ```
|
||||
#[unstable(feature = "copied", issue = "57126")]
|
||||
#[stable(feature = "copied", since = "1.35.0")]
|
||||
pub fn copied(self) -> Option<T> {
|
||||
self.map(|&mut t| t)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#![feature(box_syntax)]
|
||||
#![feature(cell_update)]
|
||||
#![feature(copied)]
|
||||
#![feature(core_private_bignum)]
|
||||
#![feature(core_private_diy_float)]
|
||||
#![feature(dec2flt)]
|
||||
|
|
Loading…
Reference in a new issue