Skip to content

Commit 3bd3360

Browse files
committed
Use DoubleEndedIterator::rfold
1 parent 35e2fee commit 3bd3360

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/sources.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ where
260260
Self: Sized,
261261
Fold: FnMut(Acc, &Self::Item) -> Acc,
262262
{
263-
self.it.rev().fold(init, move |acc, item| f(acc, &item))
263+
self.it.rfold(init, move |acc, item| f(acc, &item))
264264
}
265265
}
266266

@@ -293,9 +293,7 @@ where
293293
Self: Sized,
294294
F: FnMut(B, &mut Self::Item) -> B,
295295
{
296-
self.it
297-
.rev()
298-
.fold(init, move |acc, mut item| f(acc, &mut item))
296+
self.it.rfold(init, move |acc, mut item| f(acc, &mut item))
299297
}
300298
}
301299

@@ -360,7 +358,7 @@ where
360358
Self: Sized,
361359
Fold: FnMut(Acc, &Self::Item) -> Acc,
362360
{
363-
self.it.rev().fold(init, f)
361+
self.it.rfold(init, f)
364362
}
365363
}
366364

@@ -428,7 +426,7 @@ where
428426
Self: Sized,
429427
Fold: FnMut(Acc, &Self::Item) -> Acc,
430428
{
431-
self.it.rev().fold(init, move |acc, item| f(acc, item))
429+
self.it.rfold(init, move |acc, item| f(acc, item))
432430
}
433431
}
434432

@@ -464,7 +462,7 @@ where
464462
Self: Sized,
465463
F: FnMut(B, &mut Self::Item) -> B,
466464
{
467-
self.it.rev().fold(init, f)
465+
self.it.rfold(init, f)
468466
}
469467
}
470468

0 commit comments

Comments
 (0)