mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-29 06:44:42 +00:00
Implement Ranged
on more structs (#6921)
Now that it's in `ruff_text_size`, we can use it in a few places that we couldn't before.
This commit is contained in:
parent
fc89976c24
commit
059757a8c8
23 changed files with 104 additions and 115 deletions
|
@ -1,7 +1,7 @@
|
|||
use memchr::{memchr2, memchr3, memrchr3_iter};
|
||||
use unic_ucd_ident::{is_xid_continue, is_xid_start};
|
||||
|
||||
use ruff_text_size::{TextLen, TextRange, TextSize};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::{is_python_whitespace, Cursor};
|
||||
|
||||
|
@ -131,19 +131,12 @@ impl SimpleToken {
|
|||
pub const fn kind(&self) -> SimpleTokenKind {
|
||||
self.kind
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
pub const fn range(&self) -> TextRange {
|
||||
impl Ranged for SimpleToken {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
}
|
||||
|
||||
pub const fn start(&self) -> TextSize {
|
||||
self.range.start()
|
||||
}
|
||||
|
||||
pub const fn end(&self) -> TextSize {
|
||||
self.range.end()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue