Inline ExprPrecedence::order into Expr::precedence

This commit is contained in:
David Tolnay
2024-11-17 12:25:19 -08:00
parent 23e7ecb349
commit e5f1555000
16 changed files with 146 additions and 225 deletions

View File

@@ -1015,7 +1015,7 @@ impl<'a> State<'a> {
}
fn print_expr_maybe_paren(&mut self, expr: &hir::Expr<'_>, prec: i8) {
self.print_expr_cond_paren(expr, expr.precedence().order() < prec)
self.print_expr_cond_paren(expr, expr.precedence() < prec)
}
/// Prints an expr using syntax that's acceptable in a condition position, such as the `cond` in
@@ -1049,7 +1049,7 @@ impl<'a> State<'a> {
}
self.space();
self.word_space("=");
let npals = || parser::needs_par_as_let_scrutinee(init.precedence().order());
let npals = || parser::needs_par_as_let_scrutinee(init.precedence());
self.print_expr_cond_paren(init, Self::cond_needs_par(init) || npals())
}