Add check_generic_arg early pass
This commit is contained in:
parent
27411d6d2b
commit
03defb627c
3 changed files with 19 additions and 5 deletions
|
@ -200,11 +200,7 @@ pub trait Visitor<'ast>: Sized {
|
||||||
walk_generic_args(self, path_span, generic_args)
|
walk_generic_args(self, path_span, generic_args)
|
||||||
}
|
}
|
||||||
fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) {
|
fn visit_generic_arg(&mut self, generic_arg: &'ast GenericArg) {
|
||||||
match generic_arg {
|
walk_generic_arg(self, generic_arg)
|
||||||
GenericArg::Lifetime(lt) => self.visit_lifetime(lt),
|
|
||||||
GenericArg::Type(ty) => self.visit_ty(ty),
|
|
||||||
GenericArg::Const(ct) => self.visit_anon_const(ct),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fn visit_assoc_ty_constraint(&mut self, constraint: &'ast AssocTyConstraint) {
|
fn visit_assoc_ty_constraint(&mut self, constraint: &'ast AssocTyConstraint) {
|
||||||
walk_assoc_ty_constraint(self, constraint)
|
walk_assoc_ty_constraint(self, constraint)
|
||||||
|
@ -486,6 +482,17 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn walk_generic_arg<'a, V>(visitor: &mut V, generic_arg: &'a GenericArg)
|
||||||
|
where
|
||||||
|
V: Visitor<'a>,
|
||||||
|
{
|
||||||
|
match generic_arg {
|
||||||
|
GenericArg::Lifetime(lt) => visitor.visit_lifetime(lt),
|
||||||
|
GenericArg::Type(ty) => visitor.visit_ty(ty),
|
||||||
|
GenericArg::Const(ct) => visitor.visit_anon_const(ct),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn walk_assoc_ty_constraint<'a, V: Visitor<'a>>(
|
pub fn walk_assoc_ty_constraint<'a, V: Visitor<'a>>(
|
||||||
visitor: &mut V,
|
visitor: &mut V,
|
||||||
constraint: &'a AssocTyConstraint,
|
constraint: &'a AssocTyConstraint,
|
||||||
|
|
|
@ -195,6 +195,11 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
|
||||||
run_early_pass!(self, check_expr_post, e);
|
run_early_pass!(self, check_expr_post, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_generic_arg(&mut self, arg: &'a ast::GenericArg) {
|
||||||
|
run_early_pass!(self, check_generic_arg, arg);
|
||||||
|
ast_visit::walk_generic_arg(self, arg);
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_generic_param(&mut self, param: &'a ast::GenericParam) {
|
fn visit_generic_param(&mut self, param: &'a ast::GenericParam) {
|
||||||
run_early_pass!(self, check_generic_param, param);
|
run_early_pass!(self, check_generic_param, param);
|
||||||
ast_visit::walk_generic_param(self, param);
|
ast_visit::walk_generic_param(self, param);
|
||||||
|
|
|
@ -33,6 +33,7 @@ macro_rules! late_lint_methods {
|
||||||
fn check_expr(a: &$hir hir::Expr<$hir>);
|
fn check_expr(a: &$hir hir::Expr<$hir>);
|
||||||
fn check_expr_post(a: &$hir hir::Expr<$hir>);
|
fn check_expr_post(a: &$hir hir::Expr<$hir>);
|
||||||
fn check_ty(a: &$hir hir::Ty<$hir>);
|
fn check_ty(a: &$hir hir::Ty<$hir>);
|
||||||
|
fn check_generic_arg(a: &$hir hir::GenericArg<$hir>);
|
||||||
fn check_generic_param(a: &$hir hir::GenericParam<$hir>);
|
fn check_generic_param(a: &$hir hir::GenericParam<$hir>);
|
||||||
fn check_generics(a: &$hir hir::Generics<$hir>);
|
fn check_generics(a: &$hir hir::Generics<$hir>);
|
||||||
fn check_where_predicate(a: &$hir hir::WherePredicate<$hir>);
|
fn check_where_predicate(a: &$hir hir::WherePredicate<$hir>);
|
||||||
|
@ -176,6 +177,7 @@ macro_rules! early_lint_methods {
|
||||||
fn check_expr(a: &ast::Expr);
|
fn check_expr(a: &ast::Expr);
|
||||||
fn check_expr_post(a: &ast::Expr);
|
fn check_expr_post(a: &ast::Expr);
|
||||||
fn check_ty(a: &ast::Ty);
|
fn check_ty(a: &ast::Ty);
|
||||||
|
fn check_generic_arg(a: &ast::GenericArg);
|
||||||
fn check_generic_param(a: &ast::GenericParam);
|
fn check_generic_param(a: &ast::GenericParam);
|
||||||
fn check_generics(a: &ast::Generics);
|
fn check_generics(a: &ast::Generics);
|
||||||
fn check_where_predicate(a: &ast::WherePredicate);
|
fn check_where_predicate(a: &ast::WherePredicate);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue