From edeec6a41487e6458a9d96b328c9b784525d8f06 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 21 Nov 2018 18:34:20 +0300 Subject: Complete paths after :: --- crates/ra_editor/src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'crates/ra_editor/src') diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index ff4e8303d..c6b116159 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs @@ -148,12 +148,7 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>( syntax: SyntaxNodeRef<'a>, offset: TextUnit, ) -> Option { - let leaves = find_leaf_at_offset(syntax, offset); - let leaf = leaves - .clone() - .find(|leaf| !leaf.kind().is_trivia()) - .or_else(|| leaves.right_biased())?; - leaf.ancestors().filter_map(N::cast).next() + find_leaf_at_offset(syntax, offset).find_map(|leaf| leaf.ancestors().find_map(N::cast)) } #[cfg(test)] -- cgit v1.2.3