mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 18:43:38 +00:00
Stabilize option_insert.
This commit is contained in:
parent
28b948fc5c
commit
a931060107
@ -601,8 +601,6 @@ impl<T> Option<T> {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(option_insert)]
|
|
||||||
///
|
|
||||||
/// let mut opt = None;
|
/// let mut opt = None;
|
||||||
/// let val = opt.insert(1);
|
/// let val = opt.insert(1);
|
||||||
/// assert_eq!(*val, 1);
|
/// assert_eq!(*val, 1);
|
||||||
@ -613,7 +611,7 @@ impl<T> Option<T> {
|
|||||||
/// assert_eq!(opt.unwrap(), 3);
|
/// assert_eq!(opt.unwrap(), 3);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "option_insert", reason = "newly added", issue = "78271")]
|
#[stable(feature = "option_insert", since = "1.53.0")]
|
||||||
pub fn insert(&mut self, value: T) -> &mut T {
|
pub fn insert(&mut self, value: T) -> &mut T {
|
||||||
*self = Some(value);
|
*self = Some(value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user