Commit aa96a05
authored
First contribution here, hi! Picking up #21593 as a small intro PR.
PERF402's current "What it does" says it catches copies of an "existing
list", but the rule also fires whenever a `for` loop appends every item
of any iterable to a list while the source isn't required to be a list
(only the destination is). The issue reporter pointed this out and
suggested wording closer to "for loops that can be replaced with
`list()`", which is what I went with here.
Scope is intentionally tiny: just the `## What it does` and `## Why is
this bad?` doc comments. Violation message, example, rule logic, and
tests are unchanged so no snapshots move.
Closes #21593.
1 parent 67cbf61 commit aa96a05
1 file changed
Lines changed: 5 additions & 4 deletions
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
0 commit comments