Skip to content

Commit 8c93125

Browse files
committed
Address review comments on Peekable::next_if
1 parent 08deb86 commit 8c93125

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
@@ -1628,7 +1628,7 @@ impl<I: Iterator> Peekable<I> {
16281628
self.peeked.get_or_insert_with(|| iter.next()).as_ref()
16291629
}
16301630

1631-
/// Consume the next value of this iterator if a condition is true.
1631+
/// Consume and return the next value of this iterator if a condition is true.
16321632
///
16331633
/// If `func` returns `true` for the next value of this iterator, consume and return it.
16341634
/// Otherwise, return `None`.
@@ -1668,7 +1668,7 @@ impl<I: Iterator> Peekable<I> {
16681668
}
16691669
}
16701670

1671-
/// Consume the next item if it is equal to `expected`.
1671+
/// Consume and return the next item if it is equal to `expected`.
16721672
///
16731673
/// # Example
16741674
/// Consume a number if it's equal to 0.
@@ -1683,10 +1683,10 @@ impl<I: Iterator> Peekable<I> {
16831683
/// assert_eq!(iter.next(), Some(1));
16841684
/// ```
16851685
#[unstable(feature = "peekable_next_if", issue = "72480")]
1686-
pub fn next_if_eq<R>(&mut self, expected: &R) -> Option<I::Item>
1686+
pub fn next_if_eq<T>(&mut self, expected: &T) -> Option<I::Item>
16871687
where
1688-
R: ?Sized,
1689-
I::Item: PartialEq<R>,
1688+
T: ?Sized,
1689+
I::Item: PartialEq<T>,
16901690
{
16911691
self.next_if(|next| next == expected)
16921692
}

0 commit comments

Comments
 (0)