aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/references.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/references.rs')
-rw-r--r--crates/ra_ide_api/src/references.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index b5b1c9a16..0a76bf484 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -19,7 +19,9 @@ use ra_db::{SourceDatabase, SourceDatabaseExt};
19use ra_prof::profile; 19use ra_prof::profile;
20use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit}; 20use ra_syntax::{algo::find_node_at_offset, ast, AstNode, SourceFile, SyntaxNode, TextUnit};
21 21
22use crate::{db::RootDatabase, FilePosition, FileRange, NavigationTarget, RangeInfo}; 22use crate::{
23 db::RootDatabase, display::ToNav, FilePosition, FileRange, NavigationTarget, RangeInfo,
24};
23 25
24pub(crate) use self::{ 26pub(crate) use self::{
25 classify::{classify_name, classify_name_ref}, 27 classify::{classify_name, classify_name_ref},
@@ -76,12 +78,12 @@ pub(crate) fn find_all_refs(
76 let RangeInfo { range, info: (name, def) } = find_name(db, &syntax, position)?; 78 let RangeInfo { range, info: (name, def) } = find_name(db, &syntax, position)?;
77 79
78 let declaration = match def.kind { 80 let declaration = match def.kind {
79 NameKind::Macro(mac) => NavigationTarget::from_macro_def(db, mac), 81 NameKind::Macro(mac) => mac.to_nav(db),
80 NameKind::Field(field) => NavigationTarget::from_field(db, field), 82 NameKind::Field(field) => field.to_nav(db),
81 NameKind::AssocItem(assoc) => NavigationTarget::from_assoc_item(db, assoc), 83 NameKind::AssocItem(assoc) => assoc.to_nav(db),
82 NameKind::Def(def) => NavigationTarget::from_def(db, def)?, 84 NameKind::Def(def) => NavigationTarget::from_def(db, def)?,
83 NameKind::SelfType(ref ty) => match ty.as_adt() { 85 NameKind::SelfType(ref ty) => match ty.as_adt() {
84 Some((def_id, _)) => NavigationTarget::from_adt_def(db, def_id), 86 Some((adt, _)) => adt.to_nav(db),
85 None => return None, 87 None => return None,
86 }, 88 },
87 NameKind::Pat((_, pat)) => NavigationTarget::from_pat(db, position.file_id, pat), 89 NameKind::Pat((_, pat)) => NavigationTarget::from_pat(db, position.file_id, pat),