rust/clippy_utils/src
bors 0c42e451d6 Auto merge of #11791 - Jacherr:iter_over_hash_type, r=Jarcho
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
2023-11-14 15:55:00 +00:00
..
ast_utils Merge commit '928e72dd10' into clippyup 2021-02-25 11:25:22 +01:00
mir Reverse postorder instead of using reversed postorder 2023-09-28 23:50:56 +00:00
ty/type_certainty Format let-chains across the code base 2023-11-02 17:24:30 +01:00
ast_utils.rs Add gen blocks to ast and do some broken ast lowering 2023-10-27 13:05:48 +00:00
attrs.rs Merge commit 'd9c24d1b1e' into clippyup 2023-07-17 10:22:32 +02:00
check_proc_macro.rs Format let-chains across the code base 2023-11-02 17:24:30 +01:00
comparisons.rs Merge commit 'd9c24d1b1e' into clippyup 2023-07-17 10:22:32 +02:00
consts.rs Clean up after if chain removal 2023-11-10 18:03:13 +00:00
diagnostics.rs Remove internal feature from clippy_utils 2023-10-27 13:13:26 +00:00
eager_or_lazy.rs Improve spans for indexing expressions 2023-08-04 13:17:39 +02:00
higher.rs Clean up after if chain removal 2023-11-10 18:03:13 +00:00
hir_utils.rs Auto merge of #11736 - gernot-ohner:issue-10267, r=flip1995 2023-11-08 09:58:56 +00:00
lib.rs Auto merge of #11787 - Jarcho:divergence_check, r=dswij 2023-11-12 15:44:13 +00:00
macros.rs fix lint failures in clippy 2023-10-16 19:50:31 -07:00
numeric_literal.rs Merge commit '37f4c1725d' into clippyup 2023-07-02 14:59:02 +02:00
paths.rs implement more types to lint, fix wording 2023-11-11 21:26:50 +00:00
ptr.rs Merge commit 'ac0e10aa68' into clippyup 2022-10-06 09:44:38 +02:00
qualify_min_const_fn.rs Merge remote-tracking branch 'upstream/master' into rustup 2023-11-02 17:24:19 +01:00
source.rs Format let-chains across the code base 2023-11-02 17:24:30 +01:00
str_utils.rs Set existing doc-tests to no_run 2023-10-23 15:28:26 +00:00
sugg.rs Merge remote-tracking branch 'upstream/master' into rustup 2023-11-02 17:24:19 +01:00
sym_helper.rs Merge commit '928e72dd10' into clippyup 2021-02-25 11:25:22 +01:00
ty.rs Auto merge of #11760 - compiler-errors:escaping, r=Jarcho 2023-11-12 22:15:43 +00:00
usage.rs Merge commit '98363cbf6a' into clippyup 2023-09-12 18:44:06 +02:00
visitors.rs Merge commit 'b105fb4c39' into clippyup 2023-10-06 17:35:45 +02:00