about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-10-28 04:53:05 +0100
committerGitHub <noreply@github.com>2019-10-28 04:53:05 +0100
commitc8eefdffe9480bbd84554eab3343f71f04af8f9a (patch)
treeb7bf480b2c5b6a005db6a0d4d2b7549a791bdf5e /src/libcore
parent95f437b3cfb2fec966d7eaf69d7c2e36f9c274d1 (diff)
parent65af429c681e874bee6fb3a864ae3496517a72f4 (diff)
downloadrust-c8eefdffe9480bbd84554eab3343f71f04af8f9a.tar.gz
rust-c8eefdffe9480bbd84554eab3343f71f04af8f9a.zip
Rollup merge of #64747 - ethanboxx:master, r=Centril
Stabilize `Option::flatten`

- PR: https://github.com/rust-lang/rust/pull/60256
- Tracking issue: https://github.com/rust-lang/rust/issues/60258

@elahn

> I was trying to `flat_map()` and found `map().flatten()` does the trick. This has been on nightly for 4 months, can we stabilise it?

@ethanboxx

> @Centril Helped me get this merged. What is the stabilization process?

@Centril

> @ethanboxx I'd just file a PR to stabilize it and we'll ask T-libs to FCP.

So here I am.

I am was unsure what number to put in `since = "-"` so I copied what someone had done in a recent PR.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/option.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 89f2d7ab29c..f0ac5e749f6 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -1567,7 +1567,6 @@ impl<T> Option<Option<T>> {
     /// # Examples
     /// Basic usage:
     /// ```
-    /// #![feature(option_flattening)]
     /// let x: Option<Option<u32>> = Some(Some(6));
     /// assert_eq!(Some(6), x.flatten());
     ///
@@ -1579,13 +1578,12 @@ impl<T> Option<Option<T>> {
     /// ```
     /// Flattening once only removes one level of nesting:
     /// ```
-    /// #![feature(option_flattening)]
     /// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));
     /// assert_eq!(Some(Some(6)), x.flatten());
     /// assert_eq!(Some(6), x.flatten().flatten());
     /// ```
     #[inline]
-    #[unstable(feature = "option_flattening", issue = "60258")]
+    #[stable(feature = "option_flattening", since = "1.40.0")]
     pub fn flatten(self) -> Option<T> {
         self.and_then(convert::identity)
     }