File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -76,22 +76,21 @@ impl<A, F> Iterator for RepeatCall<F>
7676///
7777/// use itertools::unfold;
7878///
79- /// let (mut x1, mut x2) = (1u32, 1u32);
80- /// let mut fibonacci = unfold((), move |_| {
79+ /// let mut fibonacci = unfold((1u32, 1u32), |(x1, x2)| {
8180/// // Attempt to get the next Fibonacci number
82- /// let next = x1.saturating_add(x2);
81+ /// let next = x1.saturating_add(* x2);
8382///
8483/// // Shift left: ret <- x1 <- x2 <- next
85- /// let ret = x1;
86- /// x1 = x2;
87- /// x2 = next;
84+ /// let ret = * x1;
85+ /// * x1 = * x2;
86+ /// * x2 = next;
8887///
8988/// // If addition has saturated at the maximum, we are finished
90- /// if ret == x1 && ret > 1 {
91- /// return None;
89+ /// if ret == *x1 && ret > 1 {
90+ /// None
91+ /// } else {
92+ /// Some(ret)
9293/// }
93- ///
94- /// Some(ret)
9594/// });
9695///
9796/// itertools::assert_equal(fibonacci.by_ref().take(8),
You can’t perform that action at this time.
0 commit comments