Skip to content

Commit b30cff7

Browse files
Philippe-Choletjswrenn
authored andcommitted
Use try_fold in combinations::remaining_for
1 parent 09a4bd8 commit b30cff7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/combinations.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ fn remaining_for(n: usize, first: bool, indices: &[usize]) -> Option<usize> {
208208
indices
209209
.iter()
210210
.enumerate()
211-
.fold(Some(0), |sum, (i, n0)| {
212-
sum.and_then(|s| s.checked_add(checked_binomial(n - 1 - *n0, k - i)?))
211+
.try_fold(0usize, |sum, (i, n0)| {
212+
sum.checked_add(checked_binomial(n - 1 - *n0, k - i)?)
213213
})
214214
}
215215
}

0 commit comments

Comments
 (0)