diff options
author | Benjamin Coenen <[email protected]> | 2020-04-17 09:30:39 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-04-17 09:30:39 +0100 |
commit | 0a1585075c65dd6049fc11c641309c89210e222d (patch) | |
tree | ceda5ef63d2179f25a7d5abaa16fa1dc30c9867b /crates/ra_syntax/src | |
parent | 071ef268b5c8fb9afec1db912ebcc5d6577f5e73 (diff) | |
parent | 8d296be1090b21b60e509c831864ae85feec2490 (diff) |
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/algo.rs | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/ptr.rs | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/algo.rs b/crates/ra_syntax/src/algo.rs index 7f87f4212..ea41bf85d 100644 --- a/crates/ra_syntax/src/algo.rs +++ b/crates/ra_syntax/src/algo.rs | |||
@@ -351,7 +351,7 @@ fn with_children( | |||
351 | // FIXME: use a more elegant way to re-fetch the node (#1185), make | 351 | // FIXME: use a more elegant way to re-fetch the node (#1185), make |
352 | // `range` private afterwards | 352 | // `range` private afterwards |
353 | let mut ptr = SyntaxNodePtr::new(parent); | 353 | let mut ptr = SyntaxNodePtr::new(parent); |
354 | ptr.range = TextRange::offset_len(ptr.range().start(), len); | 354 | ptr.range = TextRange::offset_len(ptr.range.start(), len); |
355 | ptr.to_node(&new_root_node) | 355 | ptr.to_node(&new_root_node) |
356 | } | 356 | } |
357 | 357 | ||
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index bc48a2e71..3be648c2a 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -34,12 +34,8 @@ impl SyntaxNodePtr { | |||
34 | self.range | 34 | self.range |
35 | } | 35 | } |
36 | 36 | ||
37 | pub fn kind(&self) -> SyntaxKind { | ||
38 | self.kind | ||
39 | } | ||
40 | |||
41 | pub fn cast<N: AstNode>(self) -> Option<AstPtr<N>> { | 37 | pub fn cast<N: AstNode>(self) -> Option<AstPtr<N>> { |
42 | if !N::can_cast(self.kind()) { | 38 | if !N::can_cast(self.kind) { |
43 | return None; | 39 | return None; |
44 | } | 40 | } |
45 | Some(AstPtr { raw: self, _ty: PhantomData }) | 41 | Some(AstPtr { raw: self, _ty: PhantomData }) |
@@ -88,7 +84,7 @@ impl<N: AstNode> AstPtr<N> { | |||
88 | } | 84 | } |
89 | 85 | ||
90 | pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> { | 86 | pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> { |
91 | if !U::can_cast(self.raw.kind()) { | 87 | if !U::can_cast(self.raw.kind) { |
92 | return None; | 88 | return None; |
93 | } | 89 | } |
94 | Some(AstPtr { raw: self.raw, _ty: PhantomData }) | 90 | Some(AstPtr { raw: self.raw, _ty: PhantomData }) |