-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid panics for f-string rewrites at start-of-file (#4291)
- Loading branch information
1 parent
b913e99
commit c54e48d
Showing
6 changed files
with
52 additions
and
31 deletions.
There are no files selected for viewing
File renamed without changes.
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 @@ | ||
"{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. |
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
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
15 changes: 15 additions & 0 deletions
15
crates/ruff/src/rules/pyupgrade/snapshots/ruff__rules__pyupgrade__tests__UP032_1.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,15 @@ | ||
--- | ||
source: crates/ruff/src/rules/pyupgrade/mod.rs | ||
--- | ||
UP032_1.py:1:1: UP032 [*] Use f-string instead of `format` call | ||
| | ||
1 | "{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. | ||
| ^^^^^^^^^^^^^^^^^^^^ UP032 | ||
| | ||
= help: Convert to f-string | ||
|
||
ℹ Suggested fix | ||
1 |-"{} {}".format(a, b) # Intentionally at start-of-file, to ensure graceful handling. | ||
1 |+f"{a} {b}" # Intentionally at start-of-file, to ensure graceful handling. | ||
|
||
|