std: Stabilize option_entry feature

Stabilized:

* `Option::get_or_insert`
* `Option::get_or_insert_with`

Closes #39288
This commit is contained in:
Alex Crichton 2017-07-20 15:40:23 -07:00
parent 4c9c6e824b
commit 64c1b23374

View File

@ -671,8 +671,6 @@ pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
@ -685,7 +683,7 @@ pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_entry", issue = "39288")]
#[stable(feature = "option_entry", since = "1.20.0")]
pub fn get_or_insert(&mut self, v: T) -> &mut T {
match *self {
None => *self = Some(v),
@ -706,8 +704,6 @@ pub fn get_or_insert(&mut self, v: T) -> &mut T {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
@ -720,7 +716,7 @@ pub fn get_or_insert(&mut self, v: T) -> &mut T {
/// assert_eq!(x, Some(7));
/// ```
#[inline]
#[unstable(feature = "option_entry", issue = "39288")]
#[stable(feature = "option_entry", since = "1.20.0")]
pub fn get_or_insert_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
match *self {
None => *self = Some(f()),