about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2014-09-25 23:02:28 -0700
committerSteven Fackler <sfackler@gmail.com>2014-09-25 23:06:34 -0700
commita4844a65e282a7f603dbc20f63476dff28d84d33 (patch)
tree49f2c678368c800f61d9193bef218b694ccbc5e2 /src/libcore
parente31680ac2d2f246fedfd6ac2f02a1d38fbd6f613 (diff)
downloadrust-a4844a65e282a7f603dbc20f63476dff28d84d33.tar.gz
rust-a4844a65e282a7f603dbc20f63476dff28d84d33.zip
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.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/iter.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index f78c8c2aa0e..9799e9d3980 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -366,7 +366,7 @@ pub trait Iterator<A> {
     ///     let mut sum = 0;
     ///     for x in it {
     ///         if x > 5 {
-    ///             continue;
+    ///             break;
     ///         }
     ///         sum += x;
     ///     }
@@ -377,6 +377,8 @@ pub trait Iterator<A> {
     ///     sum
     /// }
     /// 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);
     /// ```
     #[inline]