pub trait ExprLinter: LSend {
// Required methods
fn expr(&self) -> &dyn Expr;
fn match_to_lint(
&self,
matched_tokens: &[Token],
source: &[char],
) -> Option<Lint>;
fn description(&self) -> &str;
}
Expand description
A trait that searches for tokens that fulfil Expr
s in a Document
.
Makes use of TokenStringExt::iter_chunks
to avoid matching across sentence or clause
boundaries.
Required Methods§
Sourcefn match_to_lint(
&self,
matched_tokens: &[Token],
source: &[char],
) -> Option<Lint>
fn match_to_lint( &self, matched_tokens: &[Token], source: &[char], ) -> Option<Lint>
If any portions of a Document
match Self::expr
, they are passed through ExprLinter::match_to_lint
to be
transformed into a Lint
for editor consumption.
This function may return None
to elect not to produce a lint.
Sourcefn description(&self) -> &str
fn description(&self) -> &str
A user-facing description of what kinds of grammatical errors this rule looks for. It is usually shown in settings menus.