1
Fork 0

Rollup merge of #59231 - matklad:copied, r=Centril

Stabilize Option::copied

closes https://github.com/rust-lang/rust/issues/57126
This commit is contained in:
kennytm 2019-03-16 22:42:00 +08:00
commit 7c009a4df7
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C
2 changed files with 2 additions and 7 deletions

View file

@ -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)
}

View file

@ -1,6 +1,5 @@
#![feature(box_syntax)]
#![feature(cell_update)]
#![feature(copied)]
#![feature(core_private_bignum)]
#![feature(core_private_diy_float)]
#![feature(dec2flt)]