Skip to content

Commit

Permalink
Rollup merge of rust-lang#130053 - glowcoil:next_if-docs, r=jhpratt
Browse files Browse the repository at this point in the history
fix doc comments for Peekable::next_if(_eq)

Fix references to a nonexistent `consume` function in the doc comments for `Peekable::next_if` and `Peekable::next_if_eq`.
  • Loading branch information
Zalathar authored Sep 14, 2024
2 parents 34e22e8 + d1005f5 commit 857ad22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/iter/adapters/peekable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ 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(|&x| x == 0), Some(0));
/// // The next item returned is now 1, so `consume` will return `false`.
/// // 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`.
/// assert_eq!(iter.next(), Some(1));
Expand Down Expand Up @@ -304,7 +304,7 @@ 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 `consume` will return `false`.
/// // The next item returned is now 1, so `next_if` 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`.
/// assert_eq!(iter.next(), Some(1));
Expand Down

0 comments on commit 857ad22

Please sign in to comment.