1
Fork 0

Rollup merge of #135488 - GrigorenkoPV:vec_pop_if, r=jhpratt

Stabilize `vec_pop_if`

Tracking issue: #122741

FCP completed in https://github.com/rust-lang/rust/issues/122741#issuecomment-2605116387
This commit is contained in:
Matthias Krüger 2025-02-09 19:44:50 +01:00 committed by GitHub
commit b83a30c1b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 5 deletions

View file

@ -156,7 +156,6 @@
#![feature(unicode_internals)]
#![feature(unsize)]
#![feature(unwrap_infallible)]
#![feature(vec_pop_if)]
// tidy-alphabetical-end
//
// Language features:

View file

@ -2519,8 +2519,6 @@ impl<T, A: Allocator> Vec<T, A> {
/// # Examples
///
/// ```
/// #![feature(vec_pop_if)]
///
/// let mut vec = vec![1, 2, 3, 4];
/// let pred = |x: &mut i32| *x % 2 == 0;
///
@ -2528,7 +2526,7 @@ impl<T, A: Allocator> Vec<T, A> {
/// assert_eq!(vec, [1, 2, 3]);
/// assert_eq!(vec.pop_if(pred), None);
/// ```
#[unstable(feature = "vec_pop_if", issue = "122741")]
#[stable(feature = "vec_pop_if", since = "CURRENT_RUSTC_VERSION")]
pub fn pop_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T> {
let last = self.last_mut()?;
if predicate(last) { self.pop() } else { None }

View file

@ -37,7 +37,6 @@
#![feature(local_waker)]
#![feature(str_as_str)]
#![feature(strict_provenance_lints)]
#![feature(vec_pop_if)]
#![feature(vec_deque_pop_if)]
#![feature(unique_rc_arc)]
#![feature(macro_metavar_expr_concat)]