diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ptr.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 992034ef0..80e55d2aa 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -15,9 +15,8 @@ impl SyntaxNodePtr { | |||
15 | SyntaxNodePtr { range: node.text_range(), kind: node.kind() } | 15 | SyntaxNodePtr { range: node.text_range(), kind: node.kind() } |
16 | } | 16 | } |
17 | 17 | ||
18 | pub fn to_node(self, root: &SyntaxNode) -> SyntaxNode { | 18 | pub fn to_node(self, parent: &SyntaxNode) -> SyntaxNode { |
19 | assert!(root.parent().is_none()); | 19 | successors(Some(parent.clone()), |node| { |
20 | successors(Some(root.clone()), |node| { | ||
21 | node.children().find(|it| self.range.is_subrange(&it.text_range())) | 20 | node.children().find(|it| self.range.is_subrange(&it.text_range())) |
22 | }) | 21 | }) |
23 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) | 22 | .find(|it| it.text_range() == self.range && it.kind() == self.kind) |