Auto merge of #84088 - m-ou-se:stabilize-option-insert, r=m-ou-se

Stabilize option_insert.

FCP finished here: https://github.com/rust-lang/rust/issues/78271#issuecomment-817201319
This commit is contained in:
bors 2021-04-15 12:37:19 +00:00
commit f1ca558db1

View File

@ -601,8 +601,6 @@ pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
/// # Example
///
/// ```
/// #![feature(option_insert)]
///
/// let mut opt = None;
/// let val = opt.insert(1);
/// assert_eq!(*val, 1);
@ -613,7 +611,7 @@ pub fn ok_or_else<E, F: FnOnce() -> E>(self, err: F) -> Result<T, E> {
/// assert_eq!(opt.unwrap(), 3);
/// ```
#[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 {
*self = Some(value);