pub struct Diagnostic {
pub severity: Severity,
pub rule_id: String,
pub message: String,
pub file_path: PathBuf,
pub span: Span,
pub snippet: Option<String>,
pub suggestion: Option<String>,
pub notes: Vec<String>,
}Expand description
A diagnostic message (Clippy-compatible)
Fields§
§severity: SeveritySeverity level
rule_id: StringRule ID (e.g., “RL001”)
message: StringPrimary message
file_path: PathBufSource file path
span: SpanPrimary span
snippet: Option<String>Code snippet with context
suggestion: Option<String>Suggestion/help text
notes: Vec<String>Additional notes
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn from_match_result(
result: &MatchResult,
file_path: impl Into<PathBuf>,
primary_capture: Option<&str>,
) -> Option<Self>
pub fn from_match_result( result: &MatchResult, file_path: impl Into<PathBuf>, primary_capture: Option<&str>, ) -> Option<Self>
Create a new diagnostic from a MatchResult
Sourcepub fn with_snippet(self, snippet: impl Into<String>) -> Self
pub fn with_snippet(self, snippet: impl Into<String>) -> Self
Add a code snippet
Sourcepub fn format_clippy(&self) -> String
pub fn format_clippy(&self) -> String
Format as Clippy-style output
Sourcepub fn format_json(&self) -> String
pub fn format_json(&self) -> String
Format as JSON for tooling integration
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
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