]> git.lizzy.rs Git - rust.git/commitdiff
std: Stabilize `option_entry` feature
authorAlex Crichton <alex@alexcrichton.com>
Thu, 20 Jul 2017 22:40:23 +0000 (15:40 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 25 Jul 2017 14:09:31 +0000 (07:09 -0700)
Stabilized:

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

Closes #39288

src/libcore/option.rs

index e825acad4713e2a6973b242a0e5f11be102d266f..ef41b6794105d8b62aacf75357f51d0dce320560 100644 (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()),