We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6edc596 commit 316af60Copy full SHA for 316af60
src/libcore/iter/iterator.rs
@@ -1532,14 +1532,18 @@ pub trait Iterator {
1532
/// Stopping at the first `true`:
1533
///
1534
/// ```
1535
- /// let a = [1, 2, 3];
+ /// let a = [1, 2, 3, 4];
1536
1537
/// let mut iter = a.iter();
1538
1539
- /// assert_eq!(iter.position(|&x| x == 2), Some(1));
+ /// assert_eq!(iter.position(|&x| x >= 2), Some(1));
1540
1541
/// // we can still use `iter`, as there are more elements.
1542
/// assert_eq!(iter.next(), Some(&3));
1543
+ ///
1544
+ /// // The returned index depends on iterator state
1545
+ /// assert_eq!(iter.position(|&x| x == 4), Some(0));
1546
1547
1548
#[inline]
1549
#[stable(feature = "rust1", since = "1.0.0")]
0 commit comments