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
Fix sorting in ` cargo dev update_lints` script
changelog: none
The old code cloned and sorted `usable_lints` into `sorted_usable_lints`, but then failed to do anything with `sorted_usable_lints`.
This was discovered by my new `collection_is_never_read` lint (#9267) that I'm working on!
Fix: I renamed the sorted vector to `usable_lints`. Therefore it now gets used where the unsorted one was used previously.
What it does
Adding to a collection and never using it is pointless and might indicate that the developer forgot to do something with the collection.
Currently this does not raise warnings:
The new lint would point out that
numbers
is never read.To fix the warning, one could delete all code in
main
or do something withnumbers
, such as printing it.What do people think? If this sounds useful, I'd like to do it as my first contribution.
Lint Name
collection_is_never_read
Category
suspicious
Advantage
The new code no longer unnecessarily does the work of updating the collection.
Drawbacks
No response
Example
<code>
Could be written as:
The text was updated successfully, but these errors were encountered: