mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Clarify Iterator::rposition code example
This commit is contained in:
parent
bb5a016175
commit
a20672c919
@ -2906,14 +2906,14 @@ pub trait Iterator {
|
||||
/// Stopping at the first `true`:
|
||||
///
|
||||
/// ```
|
||||
/// let a = [1, 2, 3];
|
||||
/// let a = [-1, 2, 3, 4];
|
||||
///
|
||||
/// let mut iter = a.iter();
|
||||
///
|
||||
/// assert_eq!(iter.rposition(|&x| x == 2), Some(1));
|
||||
/// assert_eq!(iter.rposition(|&x| x >= 2), Some(3));
|
||||
///
|
||||
/// // we can still use `iter`, as there are more elements.
|
||||
/// assert_eq!(iter.next(), Some(&1));
|
||||
/// assert_eq!(iter.next(), Some(&-1));
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
Loading…
Reference in New Issue
Block a user