Lint passes: add check_where_predicate and check_poly_trait_ref
This commit is contained in:
@@ -793,6 +793,17 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> {
|
|||||||
hir_visit::walk_generics(self, g);
|
hir_visit::walk_generics(self, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_where_predicate(&mut self, p: &'tcx hir::WherePredicate) {
|
||||||
|
run_lints!(self, check_where_predicate, late_passes, p);
|
||||||
|
hir_visit::walk_where_predicate(self, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_poly_trait_ref(&mut self, t: &'tcx hir::PolyTraitRef,
|
||||||
|
m: hir::TraitBoundModifier) {
|
||||||
|
run_lints!(self, check_poly_trait_ref, late_passes, t, m);
|
||||||
|
hir_visit::walk_poly_trait_ref(self, t, m);
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
|
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
|
||||||
let generics = self.generics.take();
|
let generics = self.generics.take();
|
||||||
self.generics = Some(&trait_item.generics);
|
self.generics = Some(&trait_item.generics);
|
||||||
@@ -955,6 +966,16 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> {
|
|||||||
ast_visit::walk_generics(self, g);
|
ast_visit::walk_generics(self, g);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn visit_where_predicate(&mut self, p: &'a ast::WherePredicate) {
|
||||||
|
run_lints!(self, check_where_predicate, early_passes, p);
|
||||||
|
ast_visit::walk_where_predicate(self, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef, m: &'a ast::TraitBoundModifier) {
|
||||||
|
run_lints!(self, check_poly_trait_ref, early_passes, t, m);
|
||||||
|
ast_visit::walk_poly_trait_ref(self, t, m);
|
||||||
|
}
|
||||||
|
|
||||||
fn visit_trait_item(&mut self, trait_item: &'a ast::TraitItem) {
|
fn visit_trait_item(&mut self, trait_item: &'a ast::TraitItem) {
|
||||||
self.with_lint_attrs(trait_item.id, &trait_item.attrs, |cx| {
|
self.with_lint_attrs(trait_item.id, &trait_item.attrs, |cx| {
|
||||||
run_lints!(cx, check_trait_item, early_passes, trait_item);
|
run_lints!(cx, check_trait_item, early_passes, trait_item);
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ pub trait LateLintPass<'a, 'tcx>: LintPass {
|
|||||||
fn check_ty(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::Ty) { }
|
fn check_ty(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::Ty) { }
|
||||||
fn check_generic_param(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::GenericParam) { }
|
fn check_generic_param(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::GenericParam) { }
|
||||||
fn check_generics(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::Generics) { }
|
fn check_generics(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::Generics) { }
|
||||||
|
fn check_where_predicate(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::WherePredicate) { }
|
||||||
|
fn check_poly_trait_ref(&mut self, _: &LateContext<'a, 'tcx>, _: &'tcx hir::PolyTraitRef,
|
||||||
|
_: hir::TraitBoundModifier) { }
|
||||||
fn check_fn(&mut self,
|
fn check_fn(&mut self,
|
||||||
_: &LateContext<'a, 'tcx>,
|
_: &LateContext<'a, 'tcx>,
|
||||||
_: FnKind<'tcx>,
|
_: FnKind<'tcx>,
|
||||||
@@ -230,6 +233,9 @@ pub trait EarlyLintPass: LintPass {
|
|||||||
fn check_ty(&mut self, _: &EarlyContext, _: &ast::Ty) { }
|
fn check_ty(&mut self, _: &EarlyContext, _: &ast::Ty) { }
|
||||||
fn check_generic_param(&mut self, _: &EarlyContext, _: &ast::GenericParam) { }
|
fn check_generic_param(&mut self, _: &EarlyContext, _: &ast::GenericParam) { }
|
||||||
fn check_generics(&mut self, _: &EarlyContext, _: &ast::Generics) { }
|
fn check_generics(&mut self, _: &EarlyContext, _: &ast::Generics) { }
|
||||||
|
fn check_where_predicate(&mut self, _: &EarlyContext, _: &ast::WherePredicate) { }
|
||||||
|
fn check_poly_trait_ref(&mut self, _: &EarlyContext, _: &ast::PolyTraitRef,
|
||||||
|
_: &ast::TraitBoundModifier) { }
|
||||||
fn check_fn(&mut self, _: &EarlyContext,
|
fn check_fn(&mut self, _: &EarlyContext,
|
||||||
_: ast_visit::FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
|
_: ast_visit::FnKind, _: &ast::FnDecl, _: Span, _: ast::NodeId) { }
|
||||||
fn check_fn_post(&mut self, _: &EarlyContext,
|
fn check_fn_post(&mut self, _: &EarlyContext,
|
||||||
|
|||||||
Reference in New Issue
Block a user