Open
Description
What it does
Detects usage of HashMap/Set::iter()
(or other iterator) followed by take_while()/skip_while()/map_while()
.
Categories (optional)
- Kind:
suspicious
, maybecorrectness
?
What is the advantage of the recommended code over the original code
iter()
in HashMap/Set
iterates in arbitrary order, and _while()
methods usually make sense where is there some kind of order in the iterator. This would catch using a e.g. HashMap
where a sorted structure would be required.
Drawbacks
False positives, but it seems unlikely.
Example
Note sure if anything useful can be suggested other than detecting the issue.