Fix Iterator::fuse example
The for loop would *always* exaust the iterator previously, which seems like behavior that was not intended. It's still kind of a weird function.
This commit is contained in:
parent
e31680ac2d
commit
a4844a65e2
@ -366,7 +366,7 @@ pub trait Iterator<A> {
|
|||||||
/// let mut sum = 0;
|
/// let mut sum = 0;
|
||||||
/// for x in it {
|
/// for x in it {
|
||||||
/// if x > 5 {
|
/// if x > 5 {
|
||||||
/// continue;
|
/// break;
|
||||||
/// }
|
/// }
|
||||||
/// sum += x;
|
/// sum += x;
|
||||||
/// }
|
/// }
|
||||||
@ -377,6 +377,8 @@ pub trait Iterator<A> {
|
|||||||
/// sum
|
/// sum
|
||||||
/// }
|
/// }
|
||||||
/// let x = vec![1i,2,3,7,8,9];
|
/// let x = vec![1i,2,3,7,8,9];
|
||||||
|
/// assert_eq!(process(x.into_iter()), 6);
|
||||||
|
/// let x = vec![1i,2,3];
|
||||||
/// assert_eq!(process(x.into_iter()), 1006);
|
/// assert_eq!(process(x.into_iter()), 1006);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
Loading…
Reference in New Issue
Block a user