pub trait LintPass {
// Required method
fn info(&self) -> LintPassInfo;
// Provided methods
fn check_crate<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_krate: &'ast Crate<'ast>
) { ... }
fn check_item<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_item: ItemKind<'ast>
) { ... }
fn check_field<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_field: &'ast ItemField<'ast>
) { ... }
fn check_variant<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_variant: &'ast EnumVariant<'ast>
) { ... }
fn check_body<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_body: &'ast Body<'ast>
) { ... }
fn check_stmt<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_stmt: StmtKind<'ast>
) { ... }
fn check_expr<'ast>(
&mut self,
_cx: &'ast MarkerContext<'ast>,
_expr: ExprKind<'ast>
) { ... }
}
Expand description
A LintPass visits every node like a Visitor. The difference is that a
LintPass provides some additional information about the implemented lints.
The adapter will walk through the entire AST once and give each node to the
registered LintPasses.