Skip to content

Commit

Permalink
Rearrange logic of needs_par computation in print_let
Browse files Browse the repository at this point in the history
True || needs_par_as_let_scrutinee(...) is always true.
  • Loading branch information
dtolnay committed Dec 7, 2023
1 parent 4b6d7ad commit 437eaa1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler/rustc_ast_pretty/src/pprust/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,8 +1166,11 @@ impl<'a> State<'a> {
| ast::ExprKind::Closure(..)
| ast::ExprKind::Ret(..)
| ast::ExprKind::Yeet(..) => true,
_ => parser::contains_exterior_struct_lit(expr),
} || parser::needs_par_as_let_scrutinee(expr.precedence().order()),
_ => {
parser::contains_exterior_struct_lit(expr)
|| parser::needs_par_as_let_scrutinee(expr.precedence().order())
}
},
);
}

Expand Down

0 comments on commit 437eaa1

Please sign in to comment.