]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/iter/iterator.rs
Fix confusing doc for `scan`
[rust.git] / src / libcore / iter / iterator.rs
index 2cfbc09229342b46c404134db13b77b1ca4e749d..31f77f92435d83ff72a9f04582bb6717f1c1bedd 100644 (file)
@@ -974,13 +974,13 @@ fn take(self, n: usize) -> Take<Self> where Self: Sized, {
     ///     // each iteration, we'll multiply the state by the element
     ///     *state = *state * x;
     ///
-    ///     // the value passed on to the next iteration
-    ///     Some(*state)
+    ///     // then, we'll yield the negation of the state
+    ///     Some(-*state)
     /// });
     ///
-    /// assert_eq!(iter.next(), Some(1));
-    /// assert_eq!(iter.next(), Some(2));
-    /// assert_eq!(iter.next(), Some(6));
+    /// assert_eq!(iter.next(), Some(-1));
+    /// assert_eq!(iter.next(), Some(-2));
+    /// assert_eq!(iter.next(), Some(-6));
     /// assert_eq!(iter.next(), None);
     /// ```
     #[inline]