The while_some() adapter is a simple special case map_while(|x| x). Historically it made sense to have such a method: while_some() was added to itertools 0.3 in 2015, while map_while() was stabilized in Rust 1.57 in 2021. Given the 5+ years and the current MSRV of 1.63, I think it makes sense to deprecate and eventually remove while_some().
Sampling a basic GitHub search:
- Many uses seem to be
.map().while_some(), which is equivalent to just a single map_while().
- Similarly,
repeat_with().while_some() can be from_fn().
- Some of the uses are of
rayon::ParallelIterator::while_some(), which doesn't have a map_while()
Of course the deprecation notice can just suggest map_while(identity) and let clippy et al deal with further simplifications.
The
while_some()adapter is a simple special casemap_while(|x| x). Historically it made sense to have such a method:while_some()was added toitertools 0.3in 2015, whilemap_while()was stabilized in Rust 1.57 in 2021. Given the 5+ years and the current MSRV of 1.63, I think it makes sense to deprecate and eventually removewhile_some().Sampling a basic GitHub search:
.map().while_some(), which is equivalent to just a singlemap_while().repeat_with().while_some()can befrom_fn().rayon::ParallelIterator::while_some(), which doesn't have amap_while()Of course the deprecation notice can just suggest
map_while(identity)and let clippy et al deal with further simplifications.