Skip to content

Commit

Permalink
Merge #580
Browse files Browse the repository at this point in the history
580: Deprecate `fold1` in faviour of `reduce` r=jswrenn a=WaffleLapkin

[`Iterator::reduce`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.reduce) is stable since Rust 1.51 (current stable is 1.55), so this change seems reasonable (similarly to depreciation of `foreach`)

Co-authored-by: Maybe Waffle <waffle.lapkin@gmail.com>
  • Loading branch information
bors[bot] and WaffleLapkin committed Oct 13, 2021
2 parents b6c99ba + 42033ad commit ed55a5f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Expand Up @@ -2243,6 +2243,7 @@ pub trait Itertools : Iterator {
/// assert_eq!((0..10).fold1(|x, y| x + y).unwrap_or(0), 45);
/// assert_eq!((0..0).fold1(|x, y| x * y), None);
/// ```
#[deprecated(since = "0.10.2", note = "Use `Iterator::reduce` instead")]
fn fold1<F>(mut self, f: F) -> Option<Self::Item>
where F: FnMut(Self::Item, Self::Item) -> Self::Item,
Self: Sized,
Expand Down

0 comments on commit ed55a5f

Please sign in to comment.