Pretty-print let-else with added parenthesization when needed
This commit is contained in:
parent
68854b798e
commit
94cc82c088
2 changed files with 6 additions and 2 deletions
|
@ -1238,7 +1238,11 @@ impl<'a> State<'a> {
|
|||
if let Some((init, els)) = loc.kind.init_else_opt() {
|
||||
self.nbsp();
|
||||
self.word_space("=");
|
||||
self.print_expr(init, FixupContext::default());
|
||||
self.print_expr_cond_paren(
|
||||
init,
|
||||
els.is_some() && classify::expr_trailing_brace(init).is_some(),
|
||||
FixupContext::default(),
|
||||
);
|
||||
if let Some(els) = els {
|
||||
self.cbox(INDENT_UNIT);
|
||||
self.ibox(INDENT_UNIT);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue