pub struct Fix {
pub description: String,
pub replacement: Option<String>,
pub start: Position,
pub end: Position,
}Expand description
A suggested fix for a violation.
start and end form an exact, half-open range: the character at start
is replaced and the character at end is not. Equal positions represent
an insertion. Line terminators are never included implicitly; a range that
consumes a line terminator ends at column 1 of the following line.
Fields§
§description: StringDescription of what the fix does
replacement: Option<String>The replacement text (None means delete)
start: PositionInclusive start position of the text to replace
end: PositionExclusive end position of the text to replace
Implementations§
Source§impl Fix
impl Fix
Sourcepub fn insertion(
description: impl Into<String>,
replacement: impl Into<String>,
position: Position,
) -> Fix
pub fn insertion( description: impl Into<String>, replacement: impl Into<String>, position: Position, ) -> Fix
Construct an exact insertion at position.
Sourcepub fn line_replacement(
description: impl Into<String>,
replacement: impl Into<String>,
line: usize,
original_line: &str,
line_ending: Option<&str>,
) -> Fix
pub fn line_replacement( description: impl Into<String>, replacement: impl Into<String>, line: usize, original_line: &str, line_ending: Option<&str>, ) -> Fix
Construct a replacement for one complete source line.
replacement contains line content only. When line_ending is present,
the helper appends that exact terminator and makes the range end at
column 1 of the following line. With None, the range ends before EOF
and no terminator is added.
Sourcepub fn line_range_replacement(
description: impl Into<String>,
replacement: impl Into<String>,
start_line: usize,
end_line: usize,
original_end_line: &str,
end_line_ending: Option<&str>,
) -> Fix
pub fn line_range_replacement( description: impl Into<String>, replacement: impl Into<String>, start_line: usize, end_line: usize, original_end_line: &str, end_line_ending: Option<&str>, ) -> Fix
Construct a replacement spanning complete source lines.
This is the multi-line counterpart to Self::line_replacement. The
replacement contains its internal line terminators but not the terminator
of end_line; that final terminator is supplied separately so its
inclusion is explicit and CRLF can be preserved.
Trait Implementations§
impl Eq for Fix
Source§impl Serialize for Fix
impl Serialize for Fix
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Fix
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.