mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 11:59:10 +00:00
Manually format comments around :=
in named expressions (#6634)
## Summary Attaches comments around the `:=` operator in a named expression as dangling, and formats them manually in the `named_expr.rs` formatter. Closes https://github.com/astral-sh/ruff/issues/5695. ## Test Plan `cargo test`
This commit is contained in:
parent
a128fe5148
commit
26bba11be6
4 changed files with 194 additions and 9 deletions
|
@ -8,6 +8,45 @@ if (
|
|||
):
|
||||
pass
|
||||
|
||||
if (
|
||||
# 1
|
||||
x # 2
|
||||
:= # 3
|
||||
(y) # 4
|
||||
):
|
||||
pass
|
||||
|
||||
if (
|
||||
# 1
|
||||
x # 2
|
||||
:= # 3
|
||||
(y) # 4
|
||||
# 5
|
||||
):
|
||||
pass
|
||||
|
||||
if (
|
||||
# 1
|
||||
x # 2
|
||||
# 2.5
|
||||
:= # 3
|
||||
# 3.5
|
||||
y # 4
|
||||
):
|
||||
pass
|
||||
|
||||
if (
|
||||
# 1
|
||||
x # 2
|
||||
# 2.5
|
||||
:= # 3
|
||||
# 3.5
|
||||
( # 4
|
||||
y # 5
|
||||
) # 6
|
||||
):
|
||||
pass
|
||||
|
||||
y0 = (y1 := f(x))
|
||||
|
||||
f(x:=y, z=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue