Replace row/column based Location with byte-offsets. (#3931)

This commit is contained in:
Micha Reiser 2023-04-26 20:11:02 +02:00 committed by GitHub
parent ee91598835
commit cab65b25da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
418 changed files with 6203 additions and 7040 deletions

View file

@ -1,4 +1,4 @@
use rustpython_parser::ast::Location;
use ruff_text_size::TextSize;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
@ -27,9 +27,9 @@ impl Fix {
self.edits.is_empty()
}
/// Return the [`Location`] of the first [`Edit`] in the [`Fix`].
pub fn min_location(&self) -> Option<Location> {
self.edits.iter().map(Edit::location).min()
/// Return the [`TextSize`] of the first [`Edit`] in the [`Fix`].
pub fn min_start(&self) -> Option<TextSize> {
self.edits.iter().map(Edit::start).min()
}
/// Return a slice of the [`Edit`] elements in the [`Fix`].