aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/navigation_target.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/navigation_target.rs')
-rw-r--r--crates/ra_ide_api/src/navigation_target.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs
index d806cb368..f6d7f3192 100644
--- a/crates/ra_ide_api/src/navigation_target.rs
+++ b/crates/ra_ide_api/src/navigation_target.rs
@@ -126,6 +126,19 @@ impl NavigationTarget {
126 } 126 }
127 } 127 }
128 128
129 pub(crate) fn from_adt_def(db: &RootDatabase, adt_def: hir::AdtDef) -> NavigationTarget {
130 match adt_def {
131 hir::AdtDef::Struct(s) => {
132 let (file_id, node) = s.source(db);
133 NavigationTarget::from_named(file_id.original_file(db), &*node)
134 }
135 hir::AdtDef::Enum(s) => {
136 let (file_id, node) = s.source(db);
137 NavigationTarget::from_named(file_id.original_file(db), &*node)
138 }
139 }
140 }
141
129 pub(crate) fn from_def(db: &RootDatabase, module_def: hir::ModuleDef) -> NavigationTarget { 142 pub(crate) fn from_def(db: &RootDatabase, module_def: hir::ModuleDef) -> NavigationTarget {
130 match module_def { 143 match module_def {
131 hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), 144 hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module),