pub trait Lint {
// Required methods
fn new(ctx: &LintCtx) -> Self
where Self: Sized;
fn enter_workspace(&mut self, content: &Lintable<DocumentMut>);
fn enter_crate(&mut self, content: &Lintable<DocumentMut>);
fn visit_file(&mut self, content: &mut Lintable<String>);
fn exit_crate(&mut self, content: &mut Lintable<DocumentMut>);
fn exit_workspace(&mut self, content: &mut Lintable<DocumentMut>);
// Provided method
fn visit_nonrust_file(
&mut self,
extension: &str,
content: &mut Lintable<String>,
) { ... }
}Expand description
A trait representing a single lint check.
Required Methods§
Sourcefn new(ctx: &LintCtx) -> Selfwhere
Self: Sized,
fn new(ctx: &LintCtx) -> Selfwhere
Self: Sized,
Create a new instance of this lint for a workspace.
Sourcefn enter_workspace(&mut self, content: &Lintable<DocumentMut>)
fn enter_workspace(&mut self, content: &Lintable<DocumentMut>)
Begin processing a workspace, given the parsed Cargo.toml of the workspace root.
Sourcefn enter_crate(&mut self, content: &Lintable<DocumentMut>)
fn enter_crate(&mut self, content: &Lintable<DocumentMut>)
Begin processing a crate, given the parsed Cargo.toml of the crate root.
Sourcefn visit_file(&mut self, content: &mut Lintable<String>)
fn visit_file(&mut self, content: &mut Lintable<String>)
Process a Rust source file in the current crate.
Sourcefn exit_crate(&mut self, content: &mut Lintable<DocumentMut>)
fn exit_crate(&mut self, content: &mut Lintable<DocumentMut>)
Finish processing a crate, given the parsed Cargo.toml of the crate root.
Sourcefn exit_workspace(&mut self, content: &mut Lintable<DocumentMut>)
fn exit_workspace(&mut self, content: &mut Lintable<DocumentMut>)
Finish processing a workspace, given the parsed Cargo.toml of the workspace root.
Provided Methods§
Sourcefn visit_nonrust_file(
&mut self,
extension: &str,
content: &mut Lintable<String>,
)
fn visit_nonrust_file( &mut self, extension: &str, content: &mut Lintable<String>, )
Process a non-Rust file in the current crate or workspace.
For files within the directory of a crate this is called during crate processing. For files outside of any crate this is called during workspace processing after all crates have been processed.