Closed Philippe-Cholet closed 1 year ago
Nicely spotted @Philippe-Cholet.
Possibly indicates that we should really include the overflowing parts in tests.
bors r+
Build succeeded!
The publicly hosted instance of bors-ng is deprecated and will go away soon.
If you want to self-host your own instance, instructions are here. For more help, visit the forum.
If you want to switch to GitHub's built-in merge queue, visit their help page.
I missed the "Panics" section of the sum
method. So that's more embarassing than nicely spotted.
A mistake on my part, discovered in time as code is still commented out. Note that it passed tests. It only returns None if the iterator yields None. But it would overflow whenever an addition does.
Do not product options either, as multiplications could overflow the same way. That's how I found out.
I guess
checked_sum
andchecked_product
methods would be nice. EDIT: ~Would you be interested?~ Related: https://github.com/rust-lang/rust/pull/95485