pub trait Violation: ViolationMetadata + Sized {
const FIX_AVAILABILITY: FixAvailability = FixAvailability::None;
// Required methods
fn message(&self) -> String;
fn message_formats() -> &'static [&'static str];
// Provided methods
fn fix_title(&self) -> Option<String> { ... }
fn into_diagnostic(self, range: TextRange, file: &SourceFile) -> Diagnostic { ... }
}Provided Associated Constants§
Sourceconst FIX_AVAILABILITY: FixAvailability = FixAvailability::None
const FIX_AVAILABILITY: FixAvailability = FixAvailability::None
None in the case a fix is never available or otherwise Some
FixAvailability describing the available fix.
Required Methods§
Sourcefn message_formats() -> &'static [&'static str]
fn message_formats() -> &'static [&'static str]
Returns the format strings used by message.
Provided Methods§
Sourcefn fix_title(&self) -> Option<String>
fn fix_title(&self) -> Option<String>
Returns the title for the fix. The message is also shown as an advice as part of the diagnostics.
Required for rules that have fixes.
Sourcefn into_diagnostic(self, range: TextRange, file: &SourceFile) -> Diagnostic
fn into_diagnostic(self, range: TextRange, file: &SourceFile) -> Diagnostic
Convert the violation into a Diagnostic.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl Violation for IOError
E902
Source§impl<V: AlwaysFixableViolation> Violation for V
A blanket implementation.
impl<V: AlwaysFixableViolation> Violation for V
A blanket implementation.