fix docs for Peekable::next_if{_eq}
This commit is contained in:
parent
19f42cb9bb
commit
676e29ba7f
1 changed files with 3 additions and 3 deletions
|
|
@ -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));
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -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")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue