-
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.
[
pyupgrade
] Avoid syntax error when the iterable is an non-parenthe…
…sized tuple (`UP028`) (#15543) ## Summary Resolves #15540. ## Test Plan `cargo nextest run` and `cargo insta test`.
- Loading branch information
1 parent
3950b00
commit fa239f7
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
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
17 changes: 16 additions & 1 deletion
17
...inter/src/rules/pyupgrade/snapshots/ruff_linter__rules__pyupgrade__tests__UP028_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 |
---|---|---|
@@ -1,5 +1,20 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs | ||
snapshot_kind: text | ||
--- | ||
UP028_1.py:128:5: UP028 [*] Replace `yield` over `for` loop with `yield from` | ||
| | ||
126 | # https://github.com/astral-sh/ruff/issues/15540 | ||
127 | def f(): | ||
128 | / for a in 1,: | ||
129 | | yield a | ||
| |_______________^ UP028 | ||
| | ||
= help: Replace with `yield from` | ||
|
||
ℹ Unsafe fix | ||
125 125 | | ||
126 126 | # https://github.com/astral-sh/ruff/issues/15540 | ||
127 127 | def f(): | ||
128 |- for a in 1,: | ||
129 |- yield a | ||
128 |+ yield from (1,) |