mirror of
https://github.com/astral-sh/ruff.git
synced 2025-12-04 01:36:46 +00:00
Parenthesize match..case if guards (#13513)
This commit is contained in:
parent
8012707348
commit
9442cd8fae
7 changed files with 155 additions and 88 deletions
|
|
@ -588,3 +588,28 @@ match n % 3, n % 5:
|
|||
match x:
|
||||
case Child(aaaaaaaaa, bbbbbbbbbbbbbbb, cccccc), Doc(aaaaa, bbbbbbbbbb, ddddddddddddd):
|
||||
pass
|
||||
|
||||
|
||||
match guard_comments:
|
||||
case "abcd" if ( # trailing open parentheses comment
|
||||
aaaaaaaaahhhhhhhh == 1 and bbbbbbaaaaaaaaaaa == 2
|
||||
):
|
||||
pass
|
||||
|
||||
case "bcdef" if (
|
||||
aaaaaaaaahhhhhhhh == 1 and bbbbbbaaaaaaaaaaa == 2 # trailing end of line comment
|
||||
): # comment
|
||||
pass
|
||||
|
||||
case "efgh" if (
|
||||
# leading own line comment
|
||||
aaaaaahhhhhh == 1
|
||||
):
|
||||
pass
|
||||
|
||||
case "hijk" if (
|
||||
aaaaaaaaa == 1
|
||||
# trailing own line comment
|
||||
):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue