diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index 1de0547bdb10..03b254cf7e35 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -433,21 +433,6 @@ fn visit_fn( fn visit_use(&mut self, path: &'v UsePath<'v>, hir_id: HirId) -> Self::Result { walk_use(self, path, hir_id) } - fn visit_impl_restriction( - &mut self, - impl_restriction: &'v ImplRestriction<'v>, - ) -> Self::Result { - walk_impl_restriction(self, impl_restriction) - } - fn visit_restriction_kind( - &mut self, - restriction_kind: &'v RestrictionKind<'v>, - ) -> Self::Result { - match restriction_kind { - RestrictionKind::Unrestricted => Self::Result::output(), - RestrictionKind::Restricted { path, shorthand: _ } => walk_mod_path(self, path), - } - } fn visit_trait_item(&mut self, ti: &'v TraitItem<'v>) -> Self::Result { walk_trait_item(self, ti) } @@ -643,7 +628,9 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V:: bounds, trait_item_refs, ) => { - try_visit!(visitor.visit_restriction_kind(&impl_restriction.kind)); + if let RestrictionKind::Restricted { path, shorthand: _ } = &impl_restriction.kind { + walk_list!(visitor, visit_path_segment, path.segments); + } try_visit!(visitor.visit_ident(ident)); try_visit!(visitor.visit_generics(generics)); walk_list!(visitor, visit_param_bound, bounds); @@ -1276,19 +1263,6 @@ pub fn walk_use<'v, V: Visitor<'v>>( V::Result::output() } -pub fn walk_impl_restriction<'v, V: Visitor<'v>>( - visitor: &mut V, - impl_restriction: &'v ImplRestriction<'v>, -) -> V::Result { - visitor.visit_restriction_kind(&impl_restriction.kind) -} - -pub fn walk_mod_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v ModPath<'v>) -> V::Result { - let ModPath { segments, res: _, span: _ } = path; - walk_list!(visitor, visit_path_segment, *segments); - V::Result::output() -} - pub fn walk_trait_item<'v, V: Visitor<'v>>( visitor: &mut V, trait_item: &'v TraitItem<'v>,