Skip to content

Commit 54ce792

Browse files
committed
use checked_add for upper bound
1 parent dc450af commit 54ce792

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/iter/adapters/intersperse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ where
200200
lo.saturating_sub(!started as usize)
201201
.saturating_add(next_is_some as usize)
202202
.saturating_add(lo),
203-
hi.map(|hi| {
203+
hi.and_then(|hi| {
204204
hi.saturating_sub(!started as usize)
205205
.saturating_add(next_is_some as usize)
206-
.saturating_add(hi)
206+
.checked_add(hi)
207207
}),
208208
)
209209
}

0 commit comments

Comments
 (0)