Trait rustc::lint::LintPassUnstable
[-] [+]
[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_ty_method(&mut self, _: &Context, _: &TypeMethod) { ... } fn check_trait_method(&mut self, _: &Context, _: &TraitItem) { ... } 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]) { ... } }
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
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 LintPass
es 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)
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_ty_method(&mut self, _: &Context, _: &TypeMethod)
fn check_trait_method(&mut self, _: &Context, _: &TraitItem)
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])
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])
Counterpart to enter_lint_attrs
.
Implementors
impl LintPass for WhileTrue
impl LintPass for UnusedCasts
impl LintPass for TypeLimits
impl LintPass for ImproperCTypes
impl LintPass for BoxPointers
impl LintPass for RawPointerDerive
impl LintPass for UnusedAttributes
impl LintPass for PathStatements
impl LintPass for UnusedResults
impl LintPass for NonCamelCaseTypes
impl LintPass for NonSnakeCase
impl LintPass for NonUpperCaseGlobals
impl LintPass for UnusedParens
impl LintPass for UnusedImportBraces
impl LintPass for NonShorthandFieldPatterns
impl LintPass for UnusedUnsafe
impl LintPass for UnsafeBlocks
impl LintPass for UnusedMut
impl LintPass for UnusedAllocation
impl LintPass for MissingDoc
impl LintPass for MissingCopyImplementations
impl LintPass for MissingDebugImplementations
impl LintPass for Stability
impl LintPass for UnconditionalRecursion
impl LintPass for PluginAsLibrary
impl LintPass for HardwiredLints
impl LintPass for InvalidNoMangleItems
impl LintPass for UnstableFeatures