aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/syntax_highlighting/highlights.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-13 18:35:08 +0000
committerGitHub <[email protected]>2021-01-13 18:35:08 +0000
commitdab210d9b2d877ca9ed02bd7e0c8952d133965d3 (patch)
tree1db6002c00eb85781537f81f2b0d89a1dd04ca55 /crates/ide/src/syntax_highlighting/highlights.rs
parent42e00032c6ba07eaf2f7d5886c60133c65d84cf5 (diff)
parent3d78f502bdb74a2d0b9cc8d9bb990e0a471dfb8c (diff)
Merge #7263
7263: Use upstream TextSize API r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide/src/syntax_highlighting/highlights.rs')
-rw-r--r--crates/ide/src/syntax_highlighting/highlights.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlights.rs b/crates/ide/src/syntax_highlighting/highlights.rs
index c6f0417ec..882a685a5 100644
--- a/crates/ide/src/syntax_highlighting/highlights.rs
+++ b/crates/ide/src/syntax_highlighting/highlights.rs
@@ -1,5 +1,5 @@
1//! Collects a tree of highlighted ranges and flattens it. 1//! Collects a tree of highlighted ranges and flattens it.
2use std::{cmp::Ordering, iter}; 2use std::iter;
3 3
4use stdx::equal_range_by; 4use stdx::equal_range_by;
5use syntax::TextRange; 5use syntax::TextRange;
@@ -52,7 +52,7 @@ impl Node {
52 } 52 }
53 53
54 let overlapping = 54 let overlapping =
55 equal_range_by(&self.nested, |n| ordering(n.hl_range.range, hl_range.range)); 55 equal_range_by(&self.nested, |n| TextRange::ordering(n.hl_range.range, hl_range.range));
56 56
57 if overlapping.len() == 1 57 if overlapping.len() == 1
58 && self.nested[overlapping.start].hl_range.range.contains_range(hl_range.range) 58 && self.nested[overlapping.start].hl_range.range.contains_range(hl_range.range)
@@ -90,13 +90,3 @@ impl Node {
90 } 90 }
91 } 91 }
92} 92}
93
94pub(super) fn ordering(r1: TextRange, r2: TextRange) -> Ordering {
95 if r1.end() <= r2.start() {
96 Ordering::Less
97 } else if r2.end() <= r1.start() {
98 Ordering::Greater
99 } else {
100 Ordering::Equal
101 }
102}