Skip to content

Commit cc882fc

Browse files
authored
Rollup merge of #80011 - Stupremee:stabilize-peekable-next-if, r=dtolnay
Stabilize `peekable_next_if` This PR stabilizes the `peekable_next_if` feature Resolves #72480
2 parents 23adf9f + ceda547 commit cc882fc

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

library/core/src/iter/adapters/peekable.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ impl<I: Iterator> Peekable<I> {
265265
/// # Examples
266266
/// Consume a number if it's equal to 0.
267267
/// ```
268-
/// #![feature(peekable_next_if)]
269268
/// let mut iter = (0..5).peekable();
270269
/// // The first item of the iterator is 0; consume it.
271270
/// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
@@ -277,14 +276,13 @@ impl<I: Iterator> Peekable<I> {
277276
///
278277
/// Consume any number less than 10.
279278
/// ```
280-
/// #![feature(peekable_next_if)]
281279
/// let mut iter = (1..20).peekable();
282280
/// // Consume all numbers less than 10
283281
/// while iter.next_if(|&x| x < 10).is_some() {}
284282
/// // The next value returned will be 10
285283
/// assert_eq!(iter.next(), Some(10));
286284
/// ```
287-
#[unstable(feature = "peekable_next_if", issue = "72480")]
285+
#[stable(feature = "peekable_next_if", since = "1.51.0")]
288286
pub fn next_if(&mut self, func: impl FnOnce(&I::Item) -> bool) -> Option<I::Item> {
289287
match self.next() {
290288
Some(matched) if func(&matched) => Some(matched),
@@ -302,7 +300,6 @@ impl<I: Iterator> Peekable<I> {
302300
/// # Example
303301
/// Consume a number if it's equal to 0.
304302
/// ```
305-
/// #![feature(peekable_next_if)]
306303
/// let mut iter = (0..5).peekable();
307304
/// // The first item of the iterator is 0; consume it.
308305
/// assert_eq!(iter.next_if_eq(&0), Some(0));
@@ -311,7 +308,7 @@ impl<I: Iterator> Peekable<I> {
311308
/// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
312309
/// assert_eq!(iter.next(), Some(1));
313310
/// ```
314-
#[unstable(feature = "peekable_next_if", issue = "72480")]
311+
#[stable(feature = "peekable_next_if", since = "1.51.0")]
315312
pub fn next_if_eq<T>(&mut self, expected: &T) -> Option<I::Item>
316313
where
317314
T: ?Sized,

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
#![feature(unwrap_infallible)]
6666
#![feature(option_result_unwrap_unchecked)]
6767
#![feature(option_unwrap_none)]
68-
#![feature(peekable_next_if)]
6968
#![feature(peekable_peek_mut)]
7069
#![feature(partition_point)]
7170
#![feature(once_cell)]

src/librustdoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#![feature(in_band_lifetimes)]
1010
#![feature(nll)]
1111
#![feature(or_patterns)]
12-
#![feature(peekable_next_if)]
1312
#![feature(test)]
1413
#![feature(crate_visibility_modifier)]
1514
#![feature(never_type)]

0 commit comments

Comments
 (0)