]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Rollup merge of #58975 - jtdowney:iter_arith_traits_option, r=dtolnay
authorMazdak Farrokhzad <twingoow@gmail.com>
Wed, 29 May 2019 06:15:48 +0000 (08:15 +0200)
committerGitHub <noreply@github.com>
Wed, 29 May 2019 06:15:48 +0000 (08:15 +0200)
commitd67d1f24dc8b7ba8c00dacde3ee86c75aa85e91e
tree969814388705377c8cecbf68e70d12ace3667853
parent4b9d80325a65b0375eea526409a0f3aaf1cbc23c
parent9f8d934f271fcaf9c34aefa8062b7563cfd34721
Rollup merge of #58975 - jtdowney:iter_arith_traits_option, r=dtolnay

Implement `iter::Sum` and `iter::Product` for `Option`

This is similar to the existing implementation for `Result`. It will take each item into the accumulator unless a `None` is returned.

I based a lot of this on #38580. From that discussion it didn't seem like this addition would be too controversial or difficult. One thing I still don't understand is picking the values for the `stable` attribute. This is my first non-documentation PR for rust so I am open to any feedback on improvements.
src/libcore/iter/traits/accum.rs
src/libcore/tests/iter.rs