From 8d15434c915500d22543e73d70cfae1a0e8bc5a6 Mon Sep 17 00:00:00 2001 From: Ronno Das Date: Sat, 5 Sep 2026 07:27:31 +0530 Subject: [PATCH 1/4] deprecate `while_some()` --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index df5a62202..159c7e452 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>, From afcb43f0748d44436e2f6eda37f96da413a02982 Mon Sep 17 00:00:00 2001 From: Ronno Das Date: Sat, 5 Sep 2026 07:33:24 +0530 Subject: [PATCH 2/4] removed from the specialization bench `allow` attributes do not seem to be supported in that context. --- benches/specializations.rs | 7 ------- 1 file changed, 7 deletions(-) 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 { From 36c9c712e905198ae294169aaaf93ec34bcfb795 Mon Sep 17 00:00:00 2001 From: Ronno Das Date: Sat, 5 Sep 2026 07:33:52 +0530 Subject: [PATCH 3/4] `allow`ed other test uses --- tests/laziness.rs | 1 + tests/specializations.rs | 1 + tests/test_std.rs | 1 + 3 files changed, 3 insertions(+) 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) From 2d87baf787d1cddc9a1400c77aa17b1025f37799 Mon Sep 17 00:00:00 2001 From: Ronno Das Date: Sat, 5 Sep 2026 07:37:48 +0530 Subject: [PATCH 4/4] `cargo fmt` --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 159c7e452..0cc64e211 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1902,7 +1902,7 @@ pub trait Itertools: Iterator { /// "0123456789abcdef".chars(), /// ); /// ``` - #[deprecated(note="Use .map_while() instead", since="0.16.0")] + #[deprecated(note = "Use .map_while() instead", since = "0.16.0")] fn while_some(self) -> WhileSome where Self: Sized + Iterator>,