ruff/crates/ruff_linter
w0nder1ng e22718f25f
[perflint] Simplify finding the loop target in PERF401 (#15025)
Fixes #15012.

```python
def f():
    # panics when the code can't find the loop variable
    values = [1, 2, 3]
    result = []
    for i in values:
        result.append(i + 1)
    del i
```

I'm not sure exactly why this test case panics, but I suspect the `del
i` removes the binding from the semantic model's symbols.

I changed the code to search for the correct binding by directly
iterating through the bindings. Since we know exactly which binding we
want, this should find the loop variable without any complications.
2024-12-17 08:30:32 +01:00
..
resources [perflint] Simplify finding the loop target in PERF401 (#15025) 2024-12-17 08:30:32 +01:00
src [perflint] Simplify finding the loop target in PERF401 (#15025) 2024-12-17 08:30:32 +01:00
Cargo.toml Bump version to 0.8.3 (#14937) 2024-12-12 14:13:06 +00:00