Skip to content

Commit 81c4d23

Browse files
committed
Restructure visit_ty in a more clear way
1 parent 05b989e commit 81c4d23

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

compiler/rustc_ast_lowering/src/lifetime_collector.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ impl<'this, 'ast: 'this> Visitor<'ast> for LifetimeCollectVisitor<'this, 'ast> {
3838
}
3939

4040
fn visit_ty(&mut self, t: &'ast Ty) {
41-
if let TyKind::BareFn(_) = t.kind {
42-
self.current_binders.push(t.id);
43-
}
44-
visit::walk_ty(self, t);
45-
if let TyKind::BareFn(_) = t.kind {
46-
self.current_binders.pop();
41+
match t.kind {
42+
TyKind::BareFn(_) => {
43+
self.current_binders.push(t.id);
44+
visit::walk_ty(self, t);
45+
self.current_binders.pop();
46+
}
47+
_ => {
48+
visit::walk_ty(self, t);
49+
}
4750
}
4851
}
4952
}

0 commit comments

Comments
 (0)