Restructure visit_ty in a more clear way

This commit is contained in:
Santiago Pastorino 2022-08-02 11:00:34 -03:00
parent 05b989e16e
commit 81c4d2371a
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF

View File

@ -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);
}
}
}
}