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 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 @@ fn visit_poly_trait_ref(&mut self, t: &'ast PolyTraitRef, m: &'ast TraitBoundMod } 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); + } } } }