pub struct LintViolation {
pub rule_code: &'static str,
pub message: String,
pub message_key: String,
pub message_params: Vec<(String, String)>,
pub span: Span,
pub severity: Severity,
pub fixes: Vec<SourceEdit>,
}Expand description
A single lint violation found by a rule.
Fields§
§rule_code: &'static strRule code, e.g. “CP01”.
message: StringHuman-readable message describing the violation (English).
message_key: StringTranslation key for the message (e.g. “rules.LT01.msg”).
message_params: Vec<(String, String)>Parameters for message interpolation (e.g. [(“count”, “3”)]).
span: SpanLocation in source.
severity: SeveritySeverity level.
fixes: Vec<SourceEdit>Suggested fixes (empty if not auto-fixable).
Implementations§
Source§impl LintViolation
impl LintViolation
pub fn new( rule_code: &'static str, message: impl Into<String>, span: Span, ) -> Self
Sourcepub fn with_msg_key(
rule_code: &'static str,
message: impl Into<String>,
span: Span,
message_key: impl Into<String>,
message_params: Vec<(String, String)>,
) -> Self
pub fn with_msg_key( rule_code: &'static str, message: impl Into<String>, span: Span, message_key: impl Into<String>, message_params: Vec<(String, String)>, ) -> Self
Create a violation with a translation key and parameters.
Sourcepub fn with_fix(
rule_code: &'static str,
message: impl Into<String>,
span: Span,
fixes: Vec<SourceEdit>,
) -> Self
pub fn with_fix( rule_code: &'static str, message: impl Into<String>, span: Span, fixes: Vec<SourceEdit>, ) -> Self
Create a violation with a suggested fix.
Trait Implementations§
Source§impl Clone for LintViolation
impl Clone for LintViolation
Source§fn clone(&self) -> LintViolation
fn clone(&self) -> LintViolation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LintViolation
impl RefUnwindSafe for LintViolation
impl Send for LintViolation
impl Sync for LintViolation
impl Unpin for LintViolation
impl UnsafeUnpin for LintViolation
impl UnwindSafe for LintViolation
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