mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Use upstream TextSize API
This commit is contained in:
parent
f84f5cb0ea
commit
3d78f502bd
3 changed files with 5 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
|||
//! Collects a tree of highlighted ranges and flattens it.
|
||||
use std::{cmp::Ordering, iter};
|
||||
use std::iter;
|
||||
|
||||
use stdx::equal_range_by;
|
||||
use syntax::TextRange;
|
||||
|
@ -52,7 +52,7 @@ impl Node {
|
|||
}
|
||||
|
||||
let overlapping =
|
||||
equal_range_by(&self.nested, |n| ordering(n.hl_range.range, hl_range.range));
|
||||
equal_range_by(&self.nested, |n| TextRange::ordering(n.hl_range.range, hl_range.range));
|
||||
|
||||
if overlapping.len() == 1
|
||||
&& self.nested[overlapping.start].hl_range.range.contains_range(hl_range.range)
|
||||
|
@ -90,13 +90,3 @@ impl Node {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn ordering(r1: TextRange, r2: TextRange) -> Ordering {
|
||||
if r1.end() <= r2.start() {
|
||||
Ordering::Less
|
||||
} else if r2.end() <= r1.start() {
|
||||
Ordering::Greater
|
||||
} else {
|
||||
Ordering::Equal
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue