-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
I have two (small) suggestions for improving unnecessary-iterable-allocation-for-first-element (RUF015)
-
Don't add
iter
to built-in functions that are already iterable
An example of this could belist(zip([0]))[0]
, which right now is converted tonext(iter(zip([10])))
, and my suggestion would make it not additer
so it would benext(zip([10]))
-
Handle an unpacked list
This could be something like this[*x][0]
, which should be handled likelist(x)[0]
and converts tonext(iter(x))
. I don't think this is used much in the wild, so it could be overkill to add it.
I have a first already started implementing this here. Though, as this is the first time I have written any Rust, it could likely be improved upon 😅
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule