Skip to content

Commit ee840db

Browse files
authored
Rollup merge of #76302 - jyn514:peekable-2, r=Dylan-DPC
Address review comments on `Peekable::next_if` r? @pickfire See #72310 (review) for context.
2 parents 2c62189 + 8c93125 commit ee840db

File tree

1 file changed

+5
-5
lines changed
  • library/core/src/iter/adapters

1 file changed

+5
-5
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ impl<I: Iterator> Peekable<I> {
17721772
self.peeked.get_or_insert_with(|| iter.next()).as_ref()
17731773
}
17741774

1775-
/// Consume the next value of this iterator if a condition is true.
1775+
/// Consume and return the next value of this iterator if a condition is true.
17761776
///
17771777
/// If `func` returns `true` for the next value of this iterator, consume and return it.
17781778
/// Otherwise, return `None`.
@@ -1812,7 +1812,7 @@ impl<I: Iterator> Peekable<I> {
18121812
}
18131813
}
18141814

1815-
/// Consume the next item if it is equal to `expected`.
1815+
/// Consume and return the next item if it is equal to `expected`.
18161816
///
18171817
/// # Example
18181818
/// Consume a number if it's equal to 0.
@@ -1827,10 +1827,10 @@ impl<I: Iterator> Peekable<I> {
18271827
/// assert_eq!(iter.next(), Some(1));
18281828
/// ```
18291829
#[unstable(feature = "peekable_next_if", issue = "72480")]
1830-
pub fn next_if_eq<R>(&mut self, expected: &R) -> Option<I::Item>
1830+
pub fn next_if_eq<T>(&mut self, expected: &T) -> Option<I::Item>
18311831
where
1832-
R: ?Sized,
1833-
I::Item: PartialEq<R>,
1832+
T: ?Sized,
1833+
I::Item: PartialEq<T>,
18341834
{
18351835
self.next_if(|next| next == expected)
18361836
}

0 commit comments

Comments
 (0)