File tree 1 file changed +9
-10
lines changed
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>
76
76
///
77
77
/// use itertools::unfold;
78
78
///
79
- /// let (mut x1, mut x2) = (1u32, 1u32);
80
- /// let mut fibonacci = unfold((), move |_| {
79
+ /// let mut fibonacci = unfold((1u32, 1u32), |(x1, x2)| {
81
80
/// // Attempt to get the next Fibonacci number
82
- /// let next = x1.saturating_add(x2);
81
+ /// let next = x1.saturating_add(* x2);
83
82
///
84
83
/// // 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;
88
87
///
89
88
/// // 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)
92
93
/// }
93
- ///
94
- /// Some(ret)
95
94
/// });
96
95
///
97
96
/// itertools::assert_equal(fibonacci.by_ref().take(8),
You can’t perform that action at this time.
0 commit comments