Skip to content

Commit

Permalink
std: Stabilize option_entry feature
Browse files Browse the repository at this point in the history
Stabilized:

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

Closes rust-lang#39288
  • Loading branch information
alexcrichton committed Aug 12, 2017
1 parent 1206c80 commit d85df50
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
Expand All @@ -685,7 +683,7 @@ impl<T> 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),
Expand All @@ -706,8 +704,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_entry)]
///
/// let mut x = None;
///
/// {
Expand All @@ -720,7 +716,7 @@ impl<T> 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_with<F: FnOnce() -> T>(&mut self, f: F) -> &mut T {
match *self {
None => *self = Some(f()),
Expand Down

0 comments on commit d85df50

Please sign in to comment.