diff --git a/compiler/rustc_ast_lowering/src/lifetime_collector.rs b/compiler/rustc_ast_lowering/src/lifetime_collector.rs index f67cbd69e47..586436240f1 100644 --- a/compiler/rustc_ast_lowering/src/lifetime_collector.rs +++ b/compiler/rustc_ast_lowering/src/lifetime_collector.rs @@ -38,12 +38,15 @@ impl<'this, 'ast: 'this> Visitor<'ast> for LifetimeCollectVisitor<'this, 'ast> { } fn visit_ty(&mut self, t: &'ast Ty) { - if let TyKind::BareFn(_) = t.kind { - self.current_binders.push(t.id); - } - visit::walk_ty(self, t); - if let TyKind::BareFn(_) = t.kind { - self.current_binders.pop(); + match t.kind { + TyKind::BareFn(_) => { + self.current_binders.push(t.id); + visit::walk_ty(self, t); + self.current_binders.pop(); + } + _ => { + visit::walk_ty(self, t); + } } } }