diff --git a/benches/specializations.rs b/benches/specializations.rs index 247b61481..e56bd8961 100644 --- a/benches/specializations.rs +++ b/benches/specializations.rs @@ -495,13 +495,6 @@ bench_specializations! { } v.iter().powerset() } - while_some { - {} - (0..) - .map(black_box) - .map(|i| char::from_digit(i, 16)) - .while_some() - } with_position { ExactSizeIterator { diff --git a/src/lib.rs b/src/lib.rs index df5a62202..0cc64e211 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1902,6 +1902,7 @@ pub trait Itertools: Iterator { /// "0123456789abcdef".chars(), /// ); /// ``` + #[deprecated(note = "Use .map_while() instead", since = "0.16.0")] fn while_some(self) -> WhileSome where Self: Sized + Iterator>, diff --git a/tests/laziness.rs b/tests/laziness.rs index 7fba430b0..ff3103e6b 100644 --- a/tests/laziness.rs +++ b/tests/laziness.rs @@ -205,6 +205,7 @@ must_use_tests! { take_while_inclusive { let _ = Panicking.take_while_inclusive(|x| x % 2 == 0); } + #[allow(deprecated)] while_some { let _ = Panicking.map(Some).while_some(); } diff --git a/tests/specializations.rs b/tests/specializations.rs index 2c53cf7ae..55ac41d77 100644 --- a/tests/specializations.rs +++ b/tests/specializations.rs @@ -228,6 +228,7 @@ quickcheck! { test_specializations(&v.iter().copied().take_while_inclusive(|&x| x < 100)); } + #[allow(deprecated)] fn while_some(v: Vec) -> () { test_specializations(&v.iter().map(|&x| if x < 100 { Some(2 * x) } else { None }).while_some()); } diff --git a/tests/test_std.rs b/tests/test_std.rs index 5f5cfd1eb..cacbad80e 100644 --- a/tests/test_std.rs +++ b/tests/test_std.rs @@ -1522,6 +1522,7 @@ fn format() { assert_eq!(t3, "1.10e0, 5.72e0, -2.20e1"); } +#[allow(deprecated)] #[test] fn while_some() { let ns = (1..10)