We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8cbff0b commit 77f31efCopy full SHA for 77f31ef
1 file changed
library/core/src/iter/adapters/intersperse.rs
@@ -200,10 +200,10 @@ where
200
lo.saturating_sub(!started as usize)
201
.saturating_add(next_is_some as usize)
202
.saturating_add(lo),
203
- hi.map(|hi| {
+ hi.and_then(|hi| {
204
hi.saturating_sub(!started as usize)
205
206
- .saturating_add(hi)
+ .checked_add(hi)
207
}),
208
)
209
}
0 commit comments