mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Runnig tests somehow
This commit is contained in:
parent
89e56c364f
commit
6cade3f6d8
10 changed files with 149 additions and 32 deletions
|
@ -1,7 +1,10 @@
|
|||
pub mod walk;
|
||||
pub mod visit;
|
||||
|
||||
use {SyntaxNodeRef, TextUnit, TextRange};
|
||||
use {
|
||||
SyntaxNodeRef, TextUnit, TextRange,
|
||||
text_utils::{contains_offset_nonstrict, is_subrange},
|
||||
};
|
||||
|
||||
pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffset {
|
||||
let range = node.range();
|
||||
|
@ -116,14 +119,6 @@ fn common_ancestor<'a>(n1: SyntaxNodeRef<'a>, n2: SyntaxNodeRef<'a>) -> SyntaxNo
|
|||
panic!("Can't find common ancestor of {:?} and {:?}", n1, n2)
|
||||
}
|
||||
|
||||
fn contains_offset_nonstrict(range: TextRange, offset: TextUnit) -> bool {
|
||||
range.start() <= offset && offset <= range.end()
|
||||
}
|
||||
|
||||
fn is_subrange(range: TextRange, subrange: TextRange) -> bool {
|
||||
range.start() <= subrange.start() && subrange.end() <= range.end()
|
||||
}
|
||||
|
||||
fn generate<T>(seed: Option<T>, step: impl Fn(&T) -> Option<T>) -> impl Iterator<Item=T> {
|
||||
::itertools::unfold(seed, move |slot| {
|
||||
slot.take().map(|curr| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue