1
Fork 0

Rollup merge of #126089 - wutchzone:option_take_if, r=scottmcm

Stabilize Option::take_if

Closes #98934

ed: FCP complete in https://github.com/rust-lang/rust/issues/98934#issuecomment-2104627082
This commit is contained in:
Matthias Krüger 2024-06-07 20:14:31 +02:00 committed by GitHub
commit ccbd6c29b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 4 deletions

View file

@ -23,7 +23,6 @@
#![feature(extract_if)] #![feature(extract_if)]
#![feature(if_let_guard)] #![feature(if_let_guard)]
#![feature(let_chains)] #![feature(let_chains)]
#![feature(option_take_if)]
#![feature(never_type)] #![feature(never_type)]
#![feature(type_alias_impl_trait)] #![feature(type_alias_impl_trait)]
#![recursion_limit = "512"] // For rustdoc #![recursion_limit = "512"] // For rustdoc

View file

@ -1708,8 +1708,6 @@ impl<T> Option<T> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// #![feature(option_take_if)]
///
/// let mut x = Some(42); /// let mut x = Some(42);
/// ///
/// let prev = x.take_if(|v| if *v == 42 { /// let prev = x.take_if(|v| if *v == 42 {
@ -1726,7 +1724,7 @@ impl<T> Option<T> {
/// assert_eq!(prev, Some(43)); /// assert_eq!(prev, Some(43));
/// ``` /// ```
#[inline] #[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> pub fn take_if<P>(&mut self, predicate: P) -> Option<T>
where where
P: FnOnce(&mut T) -> bool, P: FnOnce(&mut T) -> bool,