We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68854b7 commit 94cc82cCopy full SHA for 94cc82c
compiler/rustc_ast_pretty/src/pprust/state.rs
@@ -1238,7 +1238,11 @@ impl<'a> State<'a> {
1238
if let Some((init, els)) = loc.kind.init_else_opt() {
1239
self.nbsp();
1240
self.word_space("=");
1241
- self.print_expr(init, FixupContext::default());
+ self.print_expr_cond_paren(
1242
+ init,
1243
+ els.is_some() && classify::expr_trailing_brace(init).is_some(),
1244
+ FixupContext::default(),
1245
+ );
1246
if let Some(els) = els {
1247
self.cbox(INDENT_UNIT);
1248
self.ibox(INDENT_UNIT);
tests/ui/unpretty/let-else.stdout
@@ -11,5 +11,5 @@ macro_rules! expr { ($e:expr) => { $e }; }
11
12
fn main() {
13
let _ = 1 + 1 else { return; };
14
- let _ = loop {} else { return; };
+ let _ = (loop {}) else { return; };
15
}
0 commit comments