Skip to content

Commit 2125181

Browse files
author
Yuki Okushi
authored
Rollup merge of #103692 - smoelius:walk_generic_arg, r=fee1-dead
Add `walk_generic_arg` Could this please be added? I could use it for a Clippy lint.
2 parents d1ca708 + 86a4009 commit 2125181

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

compiler/rustc_hir/src/intravisit.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,7 @@ pub trait Visitor<'v>: Sized {
410410
walk_inf(self, inf);
411411
}
412412
fn visit_generic_arg(&mut self, generic_arg: &'v GenericArg<'v>) {
413-
match generic_arg {
414-
GenericArg::Lifetime(lt) => self.visit_lifetime(lt),
415-
GenericArg::Type(ty) => self.visit_ty(ty),
416-
GenericArg::Const(ct) => self.visit_anon_const(&ct.value),
417-
GenericArg::Infer(inf) => self.visit_infer(inf),
418-
}
413+
walk_generic_arg(self, generic_arg);
419414
}
420415
fn visit_lifetime(&mut self, lifetime: &'v Lifetime) {
421416
walk_lifetime(self, lifetime)
@@ -480,6 +475,15 @@ pub fn walk_label<'v, V: Visitor<'v>>(visitor: &mut V, label: &'v Label) {
480475
visitor.visit_ident(label.ident);
481476
}
482477

478+
pub fn walk_generic_arg<'v, V: Visitor<'v>>(visitor: &mut V, generic_arg: &'v GenericArg<'v>) {
479+
match generic_arg {
480+
GenericArg::Lifetime(lt) => visitor.visit_lifetime(lt),
481+
GenericArg::Type(ty) => visitor.visit_ty(ty),
482+
GenericArg::Const(ct) => visitor.visit_anon_const(&ct.value),
483+
GenericArg::Infer(inf) => visitor.visit_infer(inf),
484+
}
485+
}
486+
483487
pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime) {
484488
visitor.visit_id(lifetime.hir_id);
485489
match lifetime.name {

0 commit comments

Comments
 (0)