aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs2
-rw-r--r--crates/ra_ide_db/src/symbol_index.rs4
-rw-r--r--crates/ra_syntax/src/algo.rs2
-rw-r--r--crates/ra_syntax/src/ptr.rs8
4 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index e61846995..6289f53f3 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -175,7 +175,7 @@ impl ToNav for FileSymbol {
175 NavigationTarget { 175 NavigationTarget {
176 file_id: self.file_id, 176 file_id: self.file_id,
177 name: self.name.clone(), 177 name: self.name.clone(),
178 kind: self.ptr.kind(), 178 kind: self.kind,
179 full_range: self.ptr.range(), 179 full_range: self.ptr.range(),
180 focus_range: self.name_range, 180 focus_range: self.name_range,
181 container_name: self.container_name.clone(), 181 container_name: self.container_name.clone(),
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs
index d30458d86..937abb433 100644
--- a/crates/ra_ide_db/src/symbol_index.rs
+++ b/crates/ra_ide_db/src/symbol_index.rs
@@ -285,7 +285,7 @@ impl Query {
285 let (start, end) = SymbolIndex::map_value_to_range(indexed_value.value); 285 let (start, end) = SymbolIndex::map_value_to_range(indexed_value.value);
286 286
287 for symbol in &symbol_index.symbols[start..end] { 287 for symbol in &symbol_index.symbols[start..end] {
288 if self.only_types && !is_type(symbol.ptr.kind()) { 288 if self.only_types && !is_type(symbol.kind) {
289 continue; 289 continue;
290 } 290 }
291 if self.exact && symbol.name != self.query { 291 if self.exact && symbol.name != self.query {
@@ -312,6 +312,7 @@ fn is_type(kind: SyntaxKind) -> bool {
312pub struct FileSymbol { 312pub struct FileSymbol {
313 pub file_id: FileId, 313 pub file_id: FileId,
314 pub name: SmolStr, 314 pub name: SmolStr,
315 pub kind: SyntaxKind,
315 pub ptr: SyntaxNodePtr, 316 pub ptr: SyntaxNodePtr,
316 pub name_range: Option<TextRange>, 317 pub name_range: Option<TextRange>,
317 pub container_name: Option<SmolStr>, 318 pub container_name: Option<SmolStr>,
@@ -377,6 +378,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
377fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> { 378fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> {
378 to_symbol(node).map(move |(name, ptr, name_range)| FileSymbol { 379 to_symbol(node).map(move |(name, ptr, name_range)| FileSymbol {
379 name, 380 name,
381 kind: node.kind(),
380 ptr, 382 ptr,
381 file_id, 383 file_id,
382 name_range: Some(name_range), 384 name_range: Some(name_range),
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 })