You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Detects usage of HashMap/Set::iter() (or other iterator) followed by take_while()/skip_while()/map_while().
Categories (optional)
Kind: suspicious, maybe correctness?
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.