-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can omit parentheses layout for patterns #6933
Comments
This seems to be fixed: https://play.ruff.rs/e7f95918-d71e-479f-8fae-29cdaa476463 Closing the issue but feel free to re-open it if you think otherwise. |
This isn't fixed yet. Notice how the expression gets wrapped in parentheses. We need to avoid adding the parentheses in this case. I'm not sure why the function isn't using ruff/crates/ruff_python_formatter/src/other/match_case.rs Lines 38 to 58 in c05e462
|
We want to make this change (it improves consistency), but it's not blocking for the Beta. The challenge here is that we need to re-implement |
I'm going to remove this from the stable release since it hasn't come up often. |
Ruff avoids adding parentheses to expressions that start or end with a parenthesized node (see
can_omit_parentheses
).This is implemented by using
optional_parentheses
in conjunction with thein_parentheses_only_*
builders. We need something similar for patterns to supportThe text was updated successfully, but these errors were encountered: