From 81c4d2371aab4636c56ac5d61d391ae195d8bb0a Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 2 Aug 2022 11:00:34 -0300 Subject: [PATCH] Restructure visit_ty in a more clear way --- .../rustc_ast_lowering/src/lifetime_collector.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lifetime_collector.rs b/compiler/rustc_ast_lowering/src/lifetime_collector.rs index f67cbd69e474..586436240f12 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); + } } } }