pub struct Fix {
pub line: usize,
pub old_text: Option<String>,
pub new_text: String,
pub delete_line: bool,
pub insert_after: bool,
pub start_offset: Option<usize>,
pub end_offset: Option<usize>,
}Expand description
Represents a fix that can be applied to resolve a lint error
Fields§
§line: usizeLine number where the fix should be applied (1-indexed)
old_text: Option<String>The original text to replace (if None and new_text is empty, delete the line)
new_text: StringThe new text to insert (empty string with old_text=None means delete)
delete_line: boolWhether to delete the entire line
insert_after: boolWhether to insert new_text as a new line after the specified line
start_offset: Option<usize>Start byte offset for range-based fix (0-indexed, inclusive)
end_offset: Option<usize>End byte offset for range-based fix (0-indexed, exclusive)
Implementations§
Source§impl Fix
impl Fix
Sourcepub fn replace(line: usize, old_text: &str, new_text: &str) -> Self
👎Deprecated: Use Fix::replace_range() for offset-based fixes instead
pub fn replace(line: usize, old_text: &str, new_text: &str) -> Self
Create a fix that replaces text on a specific line
Sourcepub fn replace_line(line: usize, new_text: &str) -> Self
👎Deprecated: Use Fix::replace_range() for offset-based fixes instead
pub fn replace_line(line: usize, new_text: &str) -> Self
Create a fix that replaces an entire line
Sourcepub fn delete(line: usize) -> Self
👎Deprecated: Use Fix::replace_range() for offset-based fixes instead
pub fn delete(line: usize) -> Self
Create a fix that deletes an entire line
Sourcepub fn insert_after(line: usize, new_text: &str) -> Self
👎Deprecated: Use Fix::replace_range() for offset-based fixes instead
pub fn insert_after(line: usize, new_text: &str) -> Self
Create a fix that inserts a new line after the specified line
Sourcepub fn replace_range(
start_offset: usize,
end_offset: usize,
new_text: &str,
) -> Self
pub fn replace_range( start_offset: usize, end_offset: usize, new_text: &str, ) -> Self
Create a range-based fix that replaces bytes from start to end offset
This allows multiple fixes on the same line as long as their ranges don’t overlap.
Sourcepub fn is_range_based(&self) -> bool
pub fn is_range_based(&self) -> bool
Check if this is a range-based fix