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:
commit
b83a30c1b6
3 changed files with 1 additions and 5 deletions
|
@ -156,7 +156,6 @@
|
||||||
#![feature(unicode_internals)]
|
#![feature(unicode_internals)]
|
||||||
#![feature(unsize)]
|
#![feature(unsize)]
|
||||||
#![feature(unwrap_infallible)]
|
#![feature(unwrap_infallible)]
|
||||||
#![feature(vec_pop_if)]
|
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
//
|
//
|
||||||
// Language features:
|
// Language features:
|
||||||
|
|
|
@ -2519,8 +2519,6 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(vec_pop_if)]
|
|
||||||
///
|
|
||||||
/// let mut vec = vec![1, 2, 3, 4];
|
/// let mut vec = vec![1, 2, 3, 4];
|
||||||
/// let pred = |x: &mut i32| *x % 2 == 0;
|
/// 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, [1, 2, 3]);
|
||||||
/// assert_eq!(vec.pop_if(pred), None);
|
/// 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> {
|
pub fn pop_if(&mut self, predicate: impl FnOnce(&mut T) -> bool) -> Option<T> {
|
||||||
let last = self.last_mut()?;
|
let last = self.last_mut()?;
|
||||||
if predicate(last) { self.pop() } else { None }
|
if predicate(last) { self.pop() } else { None }
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#![feature(local_waker)]
|
#![feature(local_waker)]
|
||||||
#![feature(str_as_str)]
|
#![feature(str_as_str)]
|
||||||
#![feature(strict_provenance_lints)]
|
#![feature(strict_provenance_lints)]
|
||||||
#![feature(vec_pop_if)]
|
|
||||||
#![feature(vec_deque_pop_if)]
|
#![feature(vec_deque_pop_if)]
|
||||||
#![feature(unique_rc_arc)]
|
#![feature(unique_rc_arc)]
|
||||||
#![feature(macro_metavar_expr_concat)]
|
#![feature(macro_metavar_expr_concat)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue