Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix docs for Peekable::next_if{_eq} #139090

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions library/core/src/iter/adapters/peekable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl<I: Iterator> Peekable<I> {
/// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
/// // The next item returned is now 1, so `next_if` will return `None`.
/// assert_eq!(iter.next_if(|&x| x == 0), None);
/// // `next_if` saves the value of the next item if it was not equal to `expected`.
/// // `next_if` retains the next item if the predicate evaluates to `false` for it.
/// assert_eq!(iter.next(), Some(1));
/// ```
///
Expand Down Expand Up @@ -304,9 +304,9 @@ impl<I: Iterator> Peekable<I> {
/// 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));
/// // The next item returned is now 1, so `next_if` will return `None`.
/// // The next item returned is now 1, so `next_if_eq` will return `None`.
/// assert_eq!(iter.next_if_eq(&0), None);
/// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
/// // `next_if_eq` retains the next item if it was not equal to `expected`.
/// assert_eq!(iter.next(), Some(1));
/// ```
#[stable(feature = "peekable_next_if", since = "1.51.0")]
Expand Down
Loading