From 58307bc273dc48b062d7d873a30d10048b258380 Mon Sep 17 00:00:00 2001 From: Justus K Date: Sun, 13 Dec 2020 14:59:50 +0100 Subject: [PATCH] stabilize `peekable_next_if` --- library/core/src/iter/adapters/peekable.rs | 7 ++----- library/core/tests/lib.rs | 1 - src/librustdoc/lib.rs | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/library/core/src/iter/adapters/peekable.rs b/library/core/src/iter/adapters/peekable.rs index 2f8b9653c59..213a595e8cf 100644 --- a/library/core/src/iter/adapters/peekable.rs +++ b/library/core/src/iter/adapters/peekable.rs @@ -265,7 +265,6 @@ impl Peekable { /// # Examples /// Consume a number if it's equal to 0. /// ``` - /// #![feature(peekable_next_if)] /// let mut iter = (0..5).peekable(); /// // The first item of the iterator is 0; consume it. /// assert_eq!(iter.next_if(|&x| x == 0), Some(0)); @@ -277,14 +276,13 @@ impl Peekable { /// /// Consume any number less than 10. /// ``` - /// #![feature(peekable_next_if)] /// let mut iter = (1..20).peekable(); /// // Consume all numbers less than 10 /// while iter.next_if(|&x| x < 10).is_some() {} /// // The next value returned will be 10 /// assert_eq!(iter.next(), Some(10)); /// ``` - #[unstable(feature = "peekable_next_if", issue = "72480")] + #[stable(feature = "peekable_next_if", since = "1.49.0")] pub fn next_if(&mut self, func: impl FnOnce(&I::Item) -> bool) -> Option { match self.next() { Some(matched) if func(&matched) => Some(matched), @@ -302,7 +300,6 @@ impl Peekable { /// # Example /// Consume a number if it's equal to 0. /// ``` - /// #![feature(peekable_next_if)] /// let mut iter = (0..5).peekable(); /// // The first item of the iterator is 0; consume it. /// assert_eq!(iter.next_if_eq(&0), Some(0)); @@ -311,7 +308,7 @@ impl Peekable { /// // `next_if_eq` saves the value of the next item if it was not equal to `expected`. /// assert_eq!(iter.next(), Some(1)); /// ``` - #[unstable(feature = "peekable_next_if", issue = "72480")] + #[stable(feature = "peekable_next_if", since = "1.49.0")] pub fn next_if_eq(&mut self, expected: &T) -> Option where T: ?Sized, diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 2aa3598a0d9..1b19d7f292f 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -57,7 +57,6 @@ #![feature(never_type)] #![feature(unwrap_infallible)] #![feature(option_unwrap_none)] -#![feature(peekable_next_if)] #![feature(peekable_peek_mut)] #![feature(partition_point)] #![feature(once_cell)] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 286a29edd95..184daafca27 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -9,7 +9,6 @@ #![feature(in_band_lifetimes)] #![feature(nll)] #![feature(or_patterns)] -#![feature(peekable_next_if)] #![feature(test)] #![feature(crate_visibility_modifier)] #![feature(never_type)]