Skip to content

Commit

Permalink
Tuple*Combination::fold: avoid unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Philippe-Cholet committed Oct 27, 2023
1 parent 21004ed commit 9154da6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/adaptors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,11 @@ macro_rules! impl_tuple_combination {
F: FnMut(B, Self::Item) -> B,
{
let Self { c, item, mut iter } = self;
init = c
.map(|($($X),*,)| {
let z = item.clone().unwrap();
(z, $($X),*)
})
.fold(init, &mut f);
if let Some(z) = item.as_ref() {
init = c
.map(|($($X),*,)| (z.clone(), $($X),*))
.fold(init, &mut f);
}
while let Some(z) = iter.next() {
let c: $P<I> = iter.clone().into();
init = c
Expand Down

0 comments on commit 9154da6

Please sign in to comment.