diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-09-03 18:03:33 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2020-09-03 18:03:33 -0400 |
| commit | 8c93125c17aeb9e9252054d4ddd0095ff4e60a2e (patch) | |
| tree | b07a0fa814da62da8901fe635d551330bce7ceaa | |
| parent | 08deb863bdebfcbbb71c18acf903eca84f1df4e7 (diff) | |
| download | rust-8c93125c17aeb9e9252054d4ddd0095ff4e60a2e.tar.gz rust-8c93125c17aeb9e9252054d4ddd0095ff4e60a2e.zip | |
Address review comments on `Peekable::next_if`
| -rw-r--r-- | library/core/src/iter/adapters/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/library/core/src/iter/adapters/mod.rs b/library/core/src/iter/adapters/mod.rs index f32c3963abe..46dc77ba35c 100644 --- a/library/core/src/iter/adapters/mod.rs +++ b/library/core/src/iter/adapters/mod.rs @@ -1628,7 +1628,7 @@ impl<I: Iterator> Peekable<I> { self.peeked.get_or_insert_with(|| iter.next()).as_ref() } - /// Consume the next value of this iterator if a condition is true. + /// Consume and return the next value of this iterator if a condition is true. /// /// If `func` returns `true` for the next value of this iterator, consume and return it. /// Otherwise, return `None`. @@ -1668,7 +1668,7 @@ impl<I: Iterator> Peekable<I> { } } - /// Consume the next item if it is equal to `expected`. + /// Consume and return the next item if it is equal to `expected`. /// /// # Example /// Consume a number if it's equal to 0. @@ -1683,10 +1683,10 @@ impl<I: Iterator> Peekable<I> { /// assert_eq!(iter.next(), Some(1)); /// ``` #[unstable(feature = "peekable_next_if", issue = "72480")] - pub fn next_if_eq<R>(&mut self, expected: &R) -> Option<I::Item> + pub fn next_if_eq<T>(&mut self, expected: &T) -> Option<I::Item> where - R: ?Sized, - I::Item: PartialEq<R>, + T: ?Sized, + I::Item: PartialEq<T>, { self.next_if(|next| next == expected) } |
