use checked_add for upper bound
This commit is contained in:
parent
8cbff0b426
commit
77f31ef2b2
@ -200,10 +200,10 @@ fn intersperse_size_hint<I>(iter: &I, started: bool, next_is_some: bool) -> (usi
|
||||
lo.saturating_sub(!started as usize)
|
||||
.saturating_add(next_is_some as usize)
|
||||
.saturating_add(lo),
|
||||
hi.map(|hi| {
|
||||
hi.and_then(|hi| {
|
||||
hi.saturating_sub(!started as usize)
|
||||
.saturating_add(next_is_some as usize)
|
||||
.saturating_add(hi)
|
||||
.checked_add(hi)
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user