Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize Option::flatten #64747

Merged
merged 1 commit into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/liballoc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
#![feature(new_uninit)]
#![feature(option_flattening)]
#![feature(pattern)]
#![feature(trusted_len)]
#![feature(try_reserve)]
Expand Down
4 changes: 1 addition & 3 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,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());
///
Expand All @@ -1580,13 +1579,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)
}
Expand Down