Skip to content

Commit

Permalink
Rollup merge of #126089 - wutchzone:option_take_if, r=scottmcm
Browse files Browse the repository at this point in the history
Stabilize Option::take_if

Closes #98934

ed: FCP complete in #98934 (comment)
  • Loading branch information
matthiaskrgr authored Jun 7, 2024
2 parents 2e82d7f + 26dc8bd commit ccbd6c2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#![feature(extract_if)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(option_take_if)]
#![feature(never_type)]
#![feature(type_alias_impl_trait)]
#![recursion_limit = "512"] // For rustdoc
Expand Down
4 changes: 1 addition & 3 deletions library/core/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,8 +1708,6 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// #![feature(option_take_if)]
///
/// let mut x = Some(42);
///
/// let prev = x.take_if(|v| if *v == 42 {
Expand All @@ -1726,7 +1724,7 @@ impl<T> Option<T> {
/// assert_eq!(prev, Some(43));
/// ```
#[inline]
#[unstable(feature = "option_take_if", issue = "98934")]
#[stable(feature = "option_take_if", since = "CURRENT_RUSTC_VERSION")]
pub fn take_if<P>(&mut self, predicate: P) -> Option<T>
where
P: FnOnce(&mut T) -> bool,
Expand Down

0 comments on commit ccbd6c2

Please sign in to comment.