diff options
| author | David Tolnay <dtolnay@gmail.com> | 2023-11-29 21:19:22 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2023-12-08 15:14:44 -0800 |
| commit | 7f314acc34949df28b19054d38c6da2158072862 (patch) | |
| tree | 3a98de78796a2efb39f00ad77b804082294847fd /tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs | |
| parent | dc5ec724c0738ba3dd1bb7850987131e868f7e7a (diff) | |
| download | rust-7f314acc34949df28b19054d38c6da2158072862.tar.gz rust-7f314acc34949df28b19054d38c6da2158072862.zip | |
Delete special handling of some expr kinds from print_let
In all four of Break, Closure, Ret, Yeet, the needs_par_as_let_scrutinee
is guaranteed to return true because the .precedence().order() of those
expr kinds is <= AssocOp::LAnd.precedence().
The relevant functions in rustc_ast::util::parser are:
fn needs_par_as_let_scrutinee(order: i8) -> bool {
order <= prec_let_scrutinee_needs_par() as i8
}
fn prec_let_scrutinee_needs_par() -> usize {
AssocOp::LAnd.precedence()
}
The .precedence().order() of Closure is PREC_CLOSURE (-40) and of Break,
Ret, Yeet is PREC_JUMP (-30).
The value of AssocOp::LAnd.precedence() is 6.
So this commit causes no change in behavior, only potentially
performance by doing a redundant call to contains_exterior_struct_lit in
those four cases. This is fine because Break, Closure, Ret, Yeet should
be exceedingly rare in the position of a let scrutinee.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions
