Trait rustc::lint::LintPass [−] [src]

pub trait LintPass {
    fn get_lints(&self) -> LintArray;

    fn check_crate(&mut self, _: &Context, _: &Crate) { ... }
    fn check_ident(&mut self, _: &Context, _: Span, _: Ident) { ... }
    fn check_mod(&mut self, _: &Context, _: &Mod, _: Span, _: NodeId) { ... }
    fn check_foreign_item(&mut self, _: &Context, _: &ForeignItem) { ... }
    fn check_item(&mut self, _: &Context, _: &Item) { ... }
    fn check_local(&mut self, _: &Context, _: &Local) { ... }
    fn check_block(&mut self, _: &Context, _: &Block) { ... }
    fn check_stmt(&mut self, _: &Context, _: &Stmt) { ... }
    fn check_arm(&mut self, _: &Context, _: &Arm) { ... }
    fn check_pat(&mut self, _: &Context, _: &Pat) { ... }
    fn check_decl(&mut self, _: &Context, _: &Decl) { ... }
    fn check_expr(&mut self, _: &Context, _: &Expr) { ... }
    fn check_expr_post(&mut self, _: &Context, _: &Expr) { ... }
    fn check_ty(&mut self, _: &Context, _: &Ty) { ... }
    fn check_generics(&mut self, _: &Context, _: &Generics) { ... }
    fn check_fn(&mut self, _: &Context, _: FnKind, _: &FnDecl, _: &Block, _: Span, _: NodeId) { ... }
    fn check_trait_item(&mut self, _: &Context, _: &TraitItem) { ... }
    fn check_impl_item(&mut self, _: &Context, _: &ImplItem) { ... }
    fn check_struct_def(&mut self, _: &Context, _: &StructDef, _: Ident, _: &Generics, _: NodeId) { ... }
    fn check_struct_def_post(&mut self, _: &Context, _: &StructDef, _: Ident, _: &Generics, _: NodeId) { ... }
    fn check_struct_field(&mut self, _: &Context, _: &StructField) { ... }
    fn check_variant(&mut self, _: &Context, _: &Variant, _: &Generics) { ... }
    fn check_variant_post(&mut self, _: &Context, _: &Variant, _: &Generics) { ... }
    fn check_opt_lifetime_ref(&mut self, _: &Context, _: Span, _: &Option<Lifetime>) { ... }
    fn check_lifetime_ref(&mut self, _: &Context, _: &Lifetime) { ... }
    fn check_lifetime_def(&mut self, _: &Context, _: &LifetimeDef) { ... }
    fn check_explicit_self(&mut self, _: &Context, _: &ExplicitSelf) { ... }
    fn check_mac(&mut self, _: &Context, _: &Mac) { ... }
    fn check_path(&mut self, _: &Context, _: &Path, _: NodeId) { ... }
    fn check_attribute(&mut self, _: &Context, _: &Attribute) { ... }
    fn enter_lint_attrs(&mut self, _: &Context, _: &[Attribute]) { ... }
    fn exit_lint_attrs(&mut self, _: &Context, _: &[Attribute]) { ... }
}
Unstable

Trait for types providing lint checks.

Each check method checks a single syntax node, and should not invoke methods recursively (unlike Visitor). By default they do nothing.

Required Methods

fn get_lints(&self) -> LintArray

Unstable

Get descriptions of the lints this LintPass object can emit.

NB: there is no enforcement that the object only emits lints it registered. And some rustc internal LintPasses register lints to be emitted by other parts of the compiler. If you want enforced access restrictions for your Lint, make it a private static item in its own module.

Provided Methods

fn check_crate(&mut self, _: &Context, _: &Crate)

Unstable

fn check_ident(&mut self, _: &Context, _: Span, _: Ident)

Unstable

fn check_mod(&mut self, _: &Context, _: &Mod, _: Span, _: NodeId)

Unstable

fn check_foreign_item(&mut self, _: &Context, _: &ForeignItem)

Unstable

fn check_item(&mut self, _: &Context, _: &Item)

Unstable

fn check_local(&mut self, _: &Context, _: &Local)

Unstable

fn check_block(&mut self, _: &Context, _: &Block)

Unstable

fn check_stmt(&mut self, _: &Context, _: &Stmt)

Unstable

fn check_arm(&mut self, _: &Context, _: &Arm)

Unstable

fn check_pat(&mut self, _: &Context, _: &Pat)

Unstable

fn check_decl(&mut self, _: &Context, _: &Decl)

Unstable

fn check_expr(&mut self, _: &Context, _: &Expr)

Unstable

fn check_expr_post(&mut self, _: &Context, _: &Expr)

Unstable

fn check_ty(&mut self, _: &Context, _: &Ty)

Unstable

fn check_generics(&mut self, _: &Context, _: &Generics)

Unstable

fn check_fn(&mut self, _: &Context, _: FnKind, _: &FnDecl, _: &Block, _: Span, _: NodeId)

Unstable

fn check_trait_item(&mut self, _: &Context, _: &TraitItem)

Unstable

fn check_impl_item(&mut self, _: &Context, _: &ImplItem)

Unstable

fn check_struct_def(&mut self, _: &Context, _: &StructDef, _: Ident, _: &Generics, _: NodeId)

Unstable

fn check_struct_def_post(&mut self, _: &Context, _: &StructDef, _: Ident, _: &Generics, _: NodeId)

Unstable

fn check_struct_field(&mut self, _: &Context, _: &StructField)

Unstable

fn check_variant(&mut self, _: &Context, _: &Variant, _: &Generics)

Unstable

fn check_variant_post(&mut self, _: &Context, _: &Variant, _: &Generics)

Unstable

fn check_opt_lifetime_ref(&mut self, _: &Context, _: Span, _: &Option<Lifetime>)

Unstable

fn check_lifetime_ref(&mut self, _: &Context, _: &Lifetime)

Unstable

fn check_lifetime_def(&mut self, _: &Context, _: &LifetimeDef)

Unstable

fn check_explicit_self(&mut self, _: &Context, _: &ExplicitSelf)

Unstable

fn check_mac(&mut self, _: &Context, _: &Mac)

Unstable

fn check_path(&mut self, _: &Context, _: &Path, _: NodeId)

Unstable

fn check_attribute(&mut self, _: &Context, _: &Attribute)

Unstable

fn enter_lint_attrs(&mut self, _: &Context, _: &[Attribute])

Unstable

Called when entering a syntax node that can have lint attributes such as #[allow(...)]. Called with all the attributes of that node.

fn exit_lint_attrs(&mut self, _: &Context, _: &[Attribute])

Unstable

Counterpart to enter_lint_attrs.

Implementors