Skip to content

Commit 676e29b

Browse files
committed
fix docs for Peekable::next_if{_eq}
1 parent 19f42cb commit 676e29b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<I: Iterator> Peekable<I> {
271271
/// assert_eq!(iter.next_if(|&x| x == 0), Some(0));
272272
/// // The next item returned is now 1, so `next_if` will return `None`.
273273
/// assert_eq!(iter.next_if(|&x| x == 0), None);
274-
/// // `next_if` saves the value of the next item if it was not equal to `expected`.
274+
/// // `next_if` retains the next item if the predicate evaluates to `false` for it.
275275
/// assert_eq!(iter.next(), Some(1));
276276
/// ```
277277
///
@@ -304,9 +304,9 @@ impl<I: Iterator> Peekable<I> {
304304
/// let mut iter = (0..5).peekable();
305305
/// // The first item of the iterator is 0; consume it.
306306
/// assert_eq!(iter.next_if_eq(&0), Some(0));
307-
/// // The next item returned is now 1, so `next_if` will return `None`.
307+
/// // The next item returned is now 1, so `next_if_eq` will return `None`.
308308
/// assert_eq!(iter.next_if_eq(&0), None);
309-
/// // `next_if_eq` saves the value of the next item if it was not equal to `expected`.
309+
/// // `next_if_eq` retains the next item if it was not equal to `expected`.
310310
/// assert_eq!(iter.next(), Some(1));
311311
/// ```
312312
#[stable(feature = "peekable_next_if", since = "1.51.0")]

0 commit comments

Comments
 (0)