From 4cbc902fcc9de79893779582dac01351d1137c7f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 8 Dec 2018 19:30:35 +0300 Subject: grand module rename --- crates/ra_syntax/src/algo/mod.rs | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 crates/ra_syntax/src/algo/mod.rs (limited to 'crates/ra_syntax/src/algo') diff --git a/crates/ra_syntax/src/algo/mod.rs b/crates/ra_syntax/src/algo/mod.rs deleted file mode 100644 index 4b3548ea9..000000000 --- a/crates/ra_syntax/src/algo/mod.rs +++ /dev/null @@ -1,26 +0,0 @@ -pub mod visit; - -use crate::{SyntaxNode, SyntaxNodeRef, TextRange, TextUnit}; - -pub use rowan::LeafAtOffset; - -pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffset { - match node.0.leaf_at_offset(offset) { - LeafAtOffset::None => LeafAtOffset::None, - LeafAtOffset::Single(n) => LeafAtOffset::Single(SyntaxNode(n)), - LeafAtOffset::Between(l, r) => LeafAtOffset::Between(SyntaxNode(l), SyntaxNode(r)), - } -} - -pub fn find_covering_node(root: SyntaxNodeRef, range: TextRange) -> SyntaxNodeRef { - SyntaxNode(root.0.covering_node(range)) -} - -pub fn generate(seed: Option, step: impl Fn(&T) -> Option) -> impl Iterator { - ::itertools::unfold(seed, move |slot| { - slot.take().map(|curr| { - *slot = step(&curr); - curr - }) - }) -} -- cgit v1.2.3