pub struct Rule {
pub info: RuleInfo,
pub check: RuleCheck,
pub fix: Option<RuleFix>,
}Expand description
One lint rule in the language-neutral registry.
Fields§
§info: RuleInfo§check: RuleCheck§fix: Option<RuleFix>Implementations§
Source§impl Rule
impl Rule
Sourcepub const fn rust_line(
info: RuleInfo,
check: fn(&FileCtx<'_>) -> Vec<Violation>,
fix: Option<fn(&FileCtx<'_>, &Violation) -> Option<Fix>>,
) -> Self
pub const fn rust_line( info: RuleInfo, check: fn(&FileCtx<'_>) -> Vec<Violation>, fix: Option<fn(&FileCtx<'_>, &Violation) -> Option<Fix>>, ) -> Self
Construct a Rust line rule.
Sourcepub const fn rust_line_full(
info: RuleInfo,
check: fn(&FileCtx<'_>) -> Vec<Violation>,
fix: Option<fn(&FileCtx<'_>, &Violation) -> Option<Fix>>,
) -> Self
pub const fn rust_line_full( info: RuleInfo, check: fn(&FileCtx<'_>) -> Vec<Violation>, fix: Option<fn(&FileCtx<'_>, &Violation) -> Option<Fix>>, ) -> Self
Construct a Rust line rule that sees complete source, including test-only items.
The check must distinguish code from marker lookalikes in strings or comments.
Prefer Self::rust_line unless the rule is explicitly opted into within source.
Sourcepub const fn rust_ast(
info: RuleInfo,
check: fn(&AstCtx<'_>) -> Vec<Violation>,
fix: Option<fn(&AstCtx<'_>, &Violation) -> Option<Fix>>,
) -> Self
pub const fn rust_ast( info: RuleInfo, check: fn(&AstCtx<'_>) -> Vec<Violation>, fix: Option<fn(&AstCtx<'_>, &Violation) -> Option<Fix>>, ) -> Self
Construct a Rust AST rule.
Sourcepub const fn rust_ast_tree(
info: RuleInfo,
check: fn(&AstCtx<'_>) -> Vec<Violation>,
fix: fn(&AstCtx<'_>, &[Violation]) -> Option<String>,
) -> Self
pub const fn rust_ast_tree( info: RuleInfo, check: fn(&AstCtx<'_>) -> Vec<Violation>, fix: fn(&AstCtx<'_>, &[Violation]) -> Option<String>, ) -> Self
Construct a coordinated Rust AST-tree fix rule.
Sourcepub const fn rust_workspace(
info: RuleInfo,
check: fn(&WorkspaceCtx<'_>) -> Vec<Violation>,
) -> Self
pub const fn rust_workspace( info: RuleInfo, check: fn(&WorkspaceCtx<'_>) -> Vec<Violation>, ) -> Self
Construct a Rust workspace rule.
Sourcepub const fn workspace(
info: RuleInfo,
check: fn(&WorkspaceCtx<'_>) -> Vec<Violation>,
) -> Self
pub const fn workspace( info: RuleInfo, check: fn(&WorkspaceCtx<'_>) -> Vec<Violation>, ) -> Self
Construct a language-neutral workspace rule.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnsafeUnpin for Rule
impl UnwindSafe for Rule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more