Skip to content

Commit

Permalink
Deprecated for the std: link to the documentation.
Browse files Browse the repository at this point in the history
Strictly similar to what is done for our free function `zip`.
  • Loading branch information
Philippe-Cholet authored and jswrenn committed May 13, 2024
1 parent 49ad027 commit d1ce07d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,10 @@ 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")]
#[deprecated(
note = "Use [`Iterator::reduce`](https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.reduce) instead",
since = "0.10.2"
)]
fn fold1<F>(mut self, f: F) -> Option<Self::Item>
where
F: FnMut(Self::Item, Self::Item) -> Self::Item,
Expand Down
10 changes: 8 additions & 2 deletions src/sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ use std::mem;
/// vec![1, 1, 2, 3, 5, 8, 13, 21]);
/// assert_eq!(fibonacci.last(), Some(2_971_215_073))
/// ```
#[deprecated(note = "Use std from_fn() instead", since = "0.13.0")]
#[deprecated(
note = "Use [std::iter::from_fn](https://doc.rust-lang.org/std/iter/fn.from_fn.html) instead",
since = "0.13.0"
)]
pub fn unfold<A, St, F>(initial_state: St, f: F) -> Unfold<St, F>
where
F: FnMut(&mut St) -> Option<A>,
Expand All @@ -62,7 +65,10 @@ where
/// See [`unfold`](crate::unfold) for more information.
#[derive(Clone)]
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[deprecated(note = "Use std from_fn() instead", since = "0.13.0")]
#[deprecated(
note = "Use [std::iter::FromFn](https://doc.rust-lang.org/std/iter/struct.FromFn.html) instead",
since = "0.13.0"
)]
pub struct Unfold<St, F> {
f: F,
/// Internal state that will be passed to the closure on the next iteration
Expand Down

0 comments on commit d1ce07d

Please sign in to comment.