pub struct Fix {
pub start_byte: usize,
pub end_byte: usize,
pub replacement: Option<String>,
}Expand description
Represents an automated fix for a violation
Fields§
§start_byte: usizeByte offset where the fix starts
end_byte: usizeByte offset where the fix ends (exclusive)
replacement: Option<String>Replacement text (None = pure deletion)
Implementations§
Source§impl Fix
impl Fix
Sourcepub fn new(
start_byte: usize,
end_byte: usize,
replacement: impl Into<String>,
) -> Self
pub fn new( start_byte: usize, end_byte: usize, replacement: impl Into<String>, ) -> Self
Create a fix that replaces a byte range with new text
Sourcepub fn delete(start_byte: usize, end_byte: usize) -> Self
pub fn delete(start_byte: usize, end_byte: usize) -> Self
Create a fix that deletes a byte range
Sourcepub fn delete_line(location: &SourceLocation) -> Self
pub fn delete_line(location: &SourceLocation) -> Self
Delete an entire line (including indentation and newline)
Sourcepub fn delete_line_and_leading_blank(location: &SourceLocation) -> Self
pub fn delete_line_and_leading_blank(location: &SourceLocation) -> Self
Delete a line and any preceding blank line
Sourcepub fn delete_line_and_trailing_blank(location: &SourceLocation) -> Self
pub fn delete_line_and_trailing_blank(location: &SourceLocation) -> Self
Delete a line and any following blank line
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Fix
impl<'de> Deserialize<'de> for Fix
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Fix
impl RefUnwindSafe for Fix
impl Send for Fix
impl Sync for Fix
impl Unpin for Fix
impl UnsafeUnpin for Fix
impl UnwindSafe for Fix
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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