iter_over_hash_type and enumerate #15062
niclashoyer
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Arbitrary numbers could be fine for e.g. displaying a progress bar as you process a set |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This dumb mistake just happend to me today 💯 I did not realize that I'm iterating over a hash set instead of a vec.
By default
iter_over_hash_type
isallow
. Which seems okay, given that iterating over e.g. keys of a hash map may not be a problem. Is it possible to expand this lint to also check the usage of the iterator? Maybe into a lint that is more strict by default, something likeiter_over_hash_type_with_enumerate
?Because
hash_set.iter().enumerate()
is definitely wrong, as the numbers returned this way are truly arbitrary and not useful at all.Beta Was this translation helpful? Give feedback.
All reactions