|
1 |
| -use crate::{ |
2 |
| - const_closure::ConstFnMutClosure, |
3 |
| - ops::{NeverShortCircuit, Try}, |
4 |
| -}; |
| 1 | +use crate::ops::{NeverShortCircuit, Try}; |
5 | 2 |
|
6 | 3 | /// Like `Iterator::by_ref`, but requiring `Sized` so it can forward generics.
|
7 | 4 | ///
|
@@ -39,13 +36,12 @@ impl<I: Iterator> Iterator for ByRefSized<'_, I> {
|
39 | 36 | }
|
40 | 37 |
|
41 | 38 | #[inline]
|
42 |
| - fn fold<B, F>(self, init: B, mut f: F) -> B |
| 39 | + fn fold<B, F>(self, init: B, f: F) -> B |
43 | 40 | where
|
44 | 41 | F: FnMut(B, Self::Item) -> B,
|
45 | 42 | {
|
46 | 43 | // `fold` needs ownership, so this can't forward directly.
|
47 |
| - I::try_fold(self.0, init, ConstFnMutClosure::new(&mut f, NeverShortCircuit::wrap_mut_2_imp)) |
48 |
| - .0 |
| 44 | + I::try_fold(self.0, init, NeverShortCircuit::wrap_mut_2(f)).0 |
49 | 45 | }
|
50 | 46 |
|
51 | 47 | #[inline]
|
@@ -76,17 +72,12 @@ impl<I: DoubleEndedIterator> DoubleEndedIterator for ByRefSized<'_, I> {
|
76 | 72 | }
|
77 | 73 |
|
78 | 74 | #[inline]
|
79 |
| - fn rfold<B, F>(self, init: B, mut f: F) -> B |
| 75 | + fn rfold<B, F>(self, init: B, f: F) -> B |
80 | 76 | where
|
81 | 77 | F: FnMut(B, Self::Item) -> B,
|
82 | 78 | {
|
83 | 79 | // `rfold` needs ownership, so this can't forward directly.
|
84 |
| - I::try_rfold( |
85 |
| - self.0, |
86 |
| - init, |
87 |
| - ConstFnMutClosure::new(&mut f, NeverShortCircuit::wrap_mut_2_imp), |
88 |
| - ) |
89 |
| - .0 |
| 80 | + I::try_rfold(self.0, init, NeverShortCircuit::wrap_mut_2(f)).0 |
90 | 81 | }
|
91 | 82 |
|
92 | 83 | #[inline]
|
|
0 commit comments