Uh oh!
There was an error while loading. Please reload this page.
Pretty-print parenthesis around binary in postfix match - #124269
Conversation
rustbot
commented
Apr 22, 2024
rustbot has assigned @michaelwoerister. Use |
Uh oh!
There was an error while loading. Please reload this page.
RossSmyth
commented
Apr 22, 2024
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
6d6bc93Comparescrabsha
commented
Apr 22, 2024
I |
| ( | ||
| { 1 } + 1).match { | ||
| _ => {} | ||
| }; |
There was a problem hiding this comment.
This looks incorrect. Is it an issue in my code or in the pretty printer?
dtolnay
left a comment
There was a problem hiding this comment.
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 <sasha.pourcelot@protonmail.com>
scrabsha
commented
Apr 29, 2024
dtolnay
commented
Apr 29, 2024
@bors r+ |
bors
commented
Apr 29, 2024
Rollup of 7 pull requests Successful merges: - rust-lang#124269 (Pretty-print parenthesis around binary in postfix match) - rust-lang#124415 (Use probes more aggressively in new solver) - rust-lang#124475 (Remove direct dependencies on lazy_static, once_cell and byteorder) - rust-lang#124484 (Fixrust-lang#124478 - offset_of! returns a temporary) - rust-lang#124504 (Mark unions non-const-propagatable in `KnownPanicsLint` without calling layout) - rust-lang#124508 (coverage: Avoid hard-coded values when visiting logical ops) - rust-lang#124522 ([Refactor] Rename `Lint` and `LintGroup`'s `is_loaded` to `is_externally_loaded` ) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#124269 - scrabsha:sasha/fix-124206, r=dtolnay Pretty-print parenthesis around binary in postfix match Fixesrust-lang#124206.
Fixes#124206.