Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions library/core/src/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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.
Expand All @@ -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)
}
Expand Down