From a4844a65e282a7f603dbc20f63476dff28d84d33 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Thu, 25 Sep 2014 23:02:28 -0700 Subject: [PATCH] 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. --- src/libcore/iter.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 { /// let mut sum = 0; /// for x in it { /// if x > 5 { - /// continue; + /// break; /// } /// sum += x; /// } @@ -377,6 +377,8 @@ pub trait Iterator { /// 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]