mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:56 +00:00
Improve comment handling around PatternMatchAs
(#6797)
## Summary Follows up on https://github.com/astral-sh/ruff/pull/6652#discussion_r1300871033 with some modifications to the `PatternMatchAs` comment handling. Specifically, any comments between the `as` and the end are now formatted as dangling, and we now insert some newlines in the appropriate places. ## Test Plan `cargo test`
This commit is contained in:
parent
d08f697a04
commit
1e6d1182bf
4 changed files with 142 additions and 7 deletions
|
@ -168,6 +168,27 @@ match pattern_comments:
|
|||
pass
|
||||
|
||||
|
||||
match pattern_comments:
|
||||
case (
|
||||
pattern
|
||||
# 1
|
||||
as
|
||||
# 2
|
||||
name
|
||||
# 3
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
match subject:
|
||||
case (
|
||||
pattern # 1
|
||||
as # 2
|
||||
name # 3
|
||||
):
|
||||
pass
|
||||
|
||||
|
||||
match x:
|
||||
case (a as b) as c:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue