-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid removing too many imports in
redefined-while-unused
(#15585)
## Summary Closes #15583.
- Loading branch information
1 parent
444f799
commit 98fccec
Showing
4 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
crates/ruff_linter/resources/test/fixtures/pyflakes/F811_32.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"""Regression test for: https://github.com/astral-sh/ruff/issues/15583""" | ||
|
||
from typing import ( | ||
List, | ||
List, | ||
) | ||
|
||
|
||
def foo() -> List[int]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...er/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F811_F811_32.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
F811_32.py:5:5: F811 [*] Redefinition of unused `List` from line 4 | ||
| | ||
3 | from typing import ( | ||
4 | List, | ||
5 | List, | ||
| ^^^^ F811 | ||
6 | ) | ||
| | ||
= help: Remove definition: `List` | ||
|
||
ℹ Safe fix | ||
2 2 | | ||
3 3 | from typing import ( | ||
4 4 | List, | ||
5 |- List, | ||
6 5 | ) | ||
7 6 | | ||
8 7 | |