pub struct Lint {
pub span: Span<char>,
pub lint_kind: LintKind,
pub suggestions: Vec<Suggestion>,
pub message: String,
pub priority: u8,
}
Expand description
An error found in text.
Fields§
§span: Span<char>
The location in the source text the error lies.
Important for automatic lint resolution through Self::suggestions
.
lint_kind: LintKind
The general category the lint belongs to. Mostly used for UI elements in integrations.
suggestions: Vec<Suggestion>
A list of zero or more suggested edits that would resolve the underlying problem.
See Suggestion
.
message: String
A message to be displayed to the user describing the specific error found.
You may use the format
macro to generate more complex messages.
priority: u8
A numerical value for the importance of a lint. Lower = more important.
Implementations§
Source§impl Lint
impl Lint
Sourcepub fn spanless_hash(&self) -> u64
pub fn spanless_hash(&self) -> u64
Creates a SHA-3 hash of all elements of the lint, sans Self::span
.
This is useful for comparing lints while ignoring their position within the document.
Do not assume that these hash values are stable across Harper versions.
Sourcepub fn message_html(&self) -> String
pub fn message_html(&self) -> String
Interpret the message as Markdown and render it to HTML.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Lint
impl<'de> Deserialize<'de> for Lint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Lint
Auto Trait Implementations§
impl Freeze for Lint
impl RefUnwindSafe for Lint
impl Send for Lint
impl Sync for Lint
impl Unpin for Lint
impl UnwindSafe for Lint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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