-
Notifications
You must be signed in to change notification settings - Fork 13.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
Pretty-print parenthesis around binary in postfix match #124269
Conversation
rustbot has assigned @michaelwoerister. Use |
Could you please either give the test name something descriptive about what the test tests (idk pfix-match-paren or something) or make a new directory for postfix match within the pretty directory. Adding tests with issue numbers, while common, makes maintenance frustrating. |
027d6f0
to
6d6bc93
Compare
I |
6d6bc93
to
1fe9ade
Compare
( | ||
{ 1 } + 1).match { | ||
_ => {} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks incorrect. Is it an issue in my code or in the pretty printer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to cause double parens to be put around cases like repro!(1 + Struct {})
. ((1 + Struct {})).match { _ => {} }
In general print_expr_as_cond
is not a correct thing to be using here. That is for syntactic positions where a {
is ambiguous between being a part of the matched expression / if condition / while condition, vs being the body for the match/if/while. It isn't applicable to postfix match.
Postfix match needs to be printed like very other expression kind containing .
, such as field accesses and method call expressions and postfix await.
Signed-off-by: Sasha Pourcelot <[email protected]>
1fe9ade
to
c8ff8a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@bors r+ |
Fixes #124206.