Skip to content

Commit 899aae4

Browse files
sanxiynoli-obk
andauthored
Simplify base_expr
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
1 parent d3c69a4 commit 899aae4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

compiler/rustc_passes/src/dead.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,13 @@ fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
3737
)
3838
}
3939

40-
fn base_expr<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
41-
let mut current = expr;
40+
fn base_expr<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a>
4241
loop {
43-
match current.kind {
44-
hir::ExprKind::Field(base, ..) => {
45-
current = base;
46-
}
47-
_ => break,
42+
match expr.kind {
43+
hir::ExprKind::Field(base, ..) => expr = base,
44+
_ => return expr,
4845
}
4946
}
50-
current
5147
}
5248

5349
struct MarkSymbolVisitor<'tcx> {

0 commit comments

Comments
 (0)