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> {
|
fn base_expr<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a>
|
||||||
let mut current = expr;
|
|
||||||
loop {
|
loop {
|
||||||
match current.kind {
|
match expr.kind {
|
||||||
hir::ExprKind::Field(base, ..) => {
|
hir::ExprKind::Field(base, ..) => expr = base,
|
||||||
current = base;
|
_ => return expr,
|
||||||
}
|
|
||||||
_ => break,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
current
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct MarkSymbolVisitor<'tcx> {
|
struct MarkSymbolVisitor<'tcx> {
|
||||||
|
|
Loading…
Reference in New Issue