gradient.rs: Refactor a for-loop to iterator combinators chain.
This comes down to personal preference probably. Would understand if it was not accepted due to preference of for-loops over combinators.
Note that .for_each
was stabilized in rustc 1.21
which means it would bump the current req of ructc
from 1.20. Although the docs already mistakenly point to 1.21
.
If that's a problem .for_each
is equivalent to .map().fold(|_| ())
.