0c42e451d6
Implement new lint `iter_over_hash_type` Implements and fixes https://github.com/rust-lang/rust-clippy/issues/11788 This PR adds a new *restriction* lint `iter_over_hash_type` which prevents `Hash`-types (that is, `HashSet` and `HashMap`) from being used as the iterator in `for` loops. The justification for this is because in `Hash`-based types, the ordering of items is not guaranteed and may vary between executions of the same program on the same hardware. In addition, it reduces readability due to the unclear iteration order. The implementation of this lint also ensures the following: - Calls to `HashMap::keys`, `HashMap::values`, and `HashSet::iter` are also denied when used in `for` loops, - When this expression is used in procedural macros, it is not linted/denied. changelog: add new `iter_over_hash_type` lint to prevent unordered iterations through hashed data structures |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |