Simplify base_expr
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
This commit is contained in:
parent
d3c69a4c0d
commit
899aae465e
@ -37,17 +37,13 @@ fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
|
||||
)
|
||||
}
|
||||
|
||||
fn base_expr<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
|
||||
let mut current = expr;
|
||||
fn base_expr<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a>
|
||||
loop {
|
||||
match current.kind {
|
||||
hir::ExprKind::Field(base, ..) => {
|
||||
current = base;
|
||||
}
|
||||
_ => break,
|
||||
match expr.kind {
|
||||
hir::ExprKind::Field(base, ..) => expr = base,
|
||||
_ => return expr,
|
||||
}
|
||||
}
|
||||
current
|
||||
}
|
||||
|
||||
struct MarkSymbolVisitor<'tcx> {
|
||||
|
Loading…
Reference in New Issue
Block a user