Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/ra_ide/src/display/navigation_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ impl ToNav for FileSymbol {
NavigationTarget {
file_id: self.file_id,
name: self.name.clone(),
kind: self.ptr.kind(),
kind: self.kind,
full_range: self.ptr.range(),
focus_range: self.name_range,
container_name: self.container_name.clone(),
Expand Down
4 changes: 3 additions & 1 deletion crates/ra_ide_db/src/symbol_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl Query {
let (start, end) = SymbolIndex::map_value_to_range(indexed_value.value);

for symbol in &symbol_index.symbols[start..end] {
if self.only_types && !is_type(symbol.ptr.kind()) {
if self.only_types && !is_type(symbol.kind) {
continue;
}
if self.exact && symbol.name != self.query {
Expand All @@ -312,6 +312,7 @@ fn is_type(kind: SyntaxKind) -> bool {
pub struct FileSymbol {
pub file_id: FileId,
pub name: SmolStr,
pub kind: SyntaxKind,
pub ptr: SyntaxNodePtr,
pub name_range: Option<TextRange>,
pub container_name: Option<SmolStr>,
Expand Down Expand Up @@ -377,6 +378,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
fn to_file_symbol(node: &SyntaxNode, file_id: FileId) -> Option<FileSymbol> {
to_symbol(node).map(move |(name, ptr, name_range)| FileSymbol {
name,
kind: node.kind(),
ptr,
file_id,
name_range: Some(name_range),
Expand Down
2 changes: 1 addition & 1 deletion crates/ra_syntax/src/algo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ fn with_children(
// FIXME: use a more elegant way to re-fetch the node (#1185), make
// `range` private afterwards
let mut ptr = SyntaxNodePtr::new(parent);
ptr.range = TextRange::offset_len(ptr.range().start(), len);
ptr.range = TextRange::offset_len(ptr.range.start(), len);
ptr.to_node(&new_root_node)
}

Expand Down
8 changes: 2 additions & 6 deletions crates/ra_syntax/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,8 @@ impl SyntaxNodePtr {
self.range
}

pub fn kind(&self) -> SyntaxKind {
self.kind
}

pub fn cast<N: AstNode>(self) -> Option<AstPtr<N>> {
if !N::can_cast(self.kind()) {
if !N::can_cast(self.kind) {
return None;
}
Some(AstPtr { raw: self, _ty: PhantomData })
Expand Down Expand Up @@ -88,7 +84,7 @@ impl<N: AstNode> AstPtr<N> {
}

pub fn cast<U: AstNode>(self) -> Option<AstPtr<U>> {
if !U::can_cast(self.raw.kind()) {
if !U::can_cast(self.raw.kind) {
return None;
}
Some(AstPtr { raw: self.raw, _ty: PhantomData })
Expand Down