mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 21:40:51 -05:00
Remove copied core modules from ruff_python_formatter (#3371)
This commit is contained in:
@@ -133,6 +133,17 @@ impl<'a> Locator<'a> {
|
||||
&self.contents[start..end]
|
||||
}
|
||||
|
||||
/// Return the byte offset of the given [`Location`].
|
||||
pub fn offset(&self, location: Location) -> usize {
|
||||
let index = self.get_or_init_index();
|
||||
truncate(location, index, self.contents)
|
||||
}
|
||||
|
||||
/// Return the underlying source code.
|
||||
pub fn contents(&self) -> &'a str {
|
||||
self.contents
|
||||
}
|
||||
|
||||
pub const fn len(&self) -> usize {
|
||||
self.contents.len()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user