Skip to content

Commit c8eefdf

Browse files
authoredOct 28, 2019
Rollup merge of #64747 - ethanboxx:master, r=Centril
Stabilize `Option::flatten` - PR: #60256 - Tracking issue: #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.
2 parents 95f437b + 65af429 commit c8eefdf

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed
 

‎src/liballoc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(drain_filter)]
44
#![feature(exact_size_is_empty)]
55
#![feature(new_uninit)]
6-
#![feature(option_flattening)]
76
#![feature(pattern)]
87
#![feature(trusted_len)]
98
#![feature(try_reserve)]

‎src/libcore/option.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,6 @@ impl<T> Option<Option<T>> {
15671567
/// # Examples
15681568
/// Basic usage:
15691569
/// ```
1570-
/// #![feature(option_flattening)]
15711570
/// let x: Option<Option<u32>> = Some(Some(6));
15721571
/// assert_eq!(Some(6), x.flatten());
15731572
///
@@ -1579,13 +1578,12 @@ impl<T> Option<Option<T>> {
15791578
/// ```
15801579
/// Flattening once only removes one level of nesting:
15811580
/// ```
1582-
/// #![feature(option_flattening)]
15831581
/// let x: Option<Option<Option<u32>>> = Some(Some(Some(6)));
15841582
/// assert_eq!(Some(Some(6)), x.flatten());
15851583
/// assert_eq!(Some(6), x.flatten().flatten());
15861584
/// ```
15871585
#[inline]
1588-
#[unstable(feature = "option_flattening", issue = "60258")]
1586+
#[stable(feature = "option_flattening", since = "1.40.0")]
15891587
pub fn flatten(self) -> Option<T> {
15901588
self.and_then(convert::identity)
15911589
}

0 commit comments

Comments
 (0)