aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ptr.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-20 10:59:10 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-20 10:59:10 +0100
commit6b352ffeb346eb7c7e46e00e790c2f395907eaa6 (patch)
treef19271365126259a7975dda9ee3e1e1496a299dd /crates/ra_syntax/src/ptr.rs
parent2830d1376b05794c7bf1467fe52ad3bc0eb4ca41 (diff)
parentf3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d (diff)
Merge #1560
1560: move debug_dump to fmt::Debug r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ptr.rs')
-rw-r--r--crates/ra_syntax/src/ptr.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs
index d1b30a2c9..8665c8976 100644
--- a/crates/ra_syntax/src/ptr.rs
+++ b/crates/ra_syntax/src/ptr.rs
@@ -12,15 +12,15 @@ pub struct SyntaxNodePtr {
12 12
13impl SyntaxNodePtr { 13impl SyntaxNodePtr {
14 pub fn new(node: &SyntaxNode) -> SyntaxNodePtr { 14 pub fn new(node: &SyntaxNode) -> SyntaxNodePtr {
15 SyntaxNodePtr { range: node.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, root: &SyntaxNode) -> SyntaxNode {
19 assert!(root.parent().is_none()); 19 assert!(root.parent().is_none());
20 successors(Some(root.clone()), |node| { 20 successors(Some(root.clone()), |node| {
21 node.children().find(|it| self.range.is_subrange(&it.range())) 21 node.children().find(|it| self.range.is_subrange(&it.text_range()))
22 }) 22 })
23 .find(|it| it.range() == self.range && it.kind() == self.kind) 23 .find(|it| it.text_range() == self.range && it.kind() == self.kind)
24 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self)) 24 .unwrap_or_else(|| panic!("can't resolve local ptr to SyntaxNode: {:?}", self))
25 } 25 }
26 26