Skip to main content

LintPass

Trait LintPass 

Source
pub trait LintPass: Visitor {
    // Required methods
    fn name(&self) -> &'static str;
    fn finish(&mut self) -> Vec<Diagnostic>;
}
Expand description

A single check.

A pass is a Visitor (so it can walk the tree and collect findings as it goes) plus a way to hand back what it found. Most passes accumulate into a Vec<Diagnostic> field and return it from finish; a pass that needs a whole-program view can instead ignore the visitor methods and do its work in finish.

Required Methods§

Source

fn name(&self) -> &'static str

The rule identifier, matching the rule field of the diagnostics it emits (e.g. "eq-na").

Source

fn finish(&mut self) -> Vec<Diagnostic>

Consume everything collected during the walk. Called once, after the driver has run this pass over the program.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§