diff options
Diffstat (limited to 'crates/ra_ide_api/src/display/navigation_target.rs')
-rw-r--r-- | crates/ra_ide_api/src/display/navigation_target.rs | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index c02bc005b..7c68bb41c 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs | |||
@@ -207,12 +207,12 @@ impl NavigationTarget { | |||
207 | ) | 207 | ) |
208 | } | 208 | } |
209 | hir::AdtDef::Enum(s) => { | 209 | hir::AdtDef::Enum(s) => { |
210 | let (file_id, node) = s.source(db); | 210 | let src = s.source(db); |
211 | NavigationTarget::from_named( | 211 | NavigationTarget::from_named( |
212 | file_id.original_file(db), | 212 | src.file_id.original_file(db), |
213 | &*node, | 213 | &*src.ast, |
214 | node.doc_comment_text(), | 214 | src.ast.doc_comment_text(), |
215 | node.short_label(), | 215 | src.ast.short_label(), |
216 | ) | 216 | ) |
217 | } | 217 | } |
218 | } | 218 | } |
@@ -225,24 +225,9 @@ impl NavigationTarget { | |||
225 | let nav = match module_def { | 225 | let nav = match module_def { |
226 | hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), | 226 | hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), |
227 | hir::ModuleDef::Function(func) => NavigationTarget::from_function(db, func), | 227 | hir::ModuleDef::Function(func) => NavigationTarget::from_function(db, func), |
228 | hir::ModuleDef::Struct(s) => { | 228 | hir::ModuleDef::Struct(it) => NavigationTarget::from_adt_def(db, it.into()), |
229 | let src = s.source(db); | 229 | hir::ModuleDef::Enum(it) => NavigationTarget::from_adt_def(db, it.into()), |
230 | NavigationTarget::from_named( | 230 | hir::ModuleDef::Union(it) => NavigationTarget::from_adt_def(db, it.into()), |
231 | src.file_id.original_file(db), | ||
232 | &*src.ast, | ||
233 | src.ast.doc_comment_text(), | ||
234 | src.ast.short_label(), | ||
235 | ) | ||
236 | } | ||
237 | hir::ModuleDef::Union(s) => { | ||
238 | let (file_id, node) = s.source(db); | ||
239 | NavigationTarget::from_named( | ||
240 | file_id.original_file(db), | ||
241 | &*node, | ||
242 | node.doc_comment_text(), | ||
243 | node.short_label(), | ||
244 | ) | ||
245 | } | ||
246 | hir::ModuleDef::Const(s) => { | 231 | hir::ModuleDef::Const(s) => { |
247 | let (file_id, node) = s.source(db); | 232 | let (file_id, node) = s.source(db); |
248 | NavigationTarget::from_named( | 233 | NavigationTarget::from_named( |
@@ -261,22 +246,13 @@ impl NavigationTarget { | |||
261 | node.short_label(), | 246 | node.short_label(), |
262 | ) | 247 | ) |
263 | } | 248 | } |
264 | hir::ModuleDef::Enum(e) => { | ||
265 | let (file_id, node) = e.source(db); | ||
266 | NavigationTarget::from_named( | ||
267 | file_id.original_file(db), | ||
268 | &*node, | ||
269 | node.doc_comment_text(), | ||
270 | node.short_label(), | ||
271 | ) | ||
272 | } | ||
273 | hir::ModuleDef::EnumVariant(var) => { | 249 | hir::ModuleDef::EnumVariant(var) => { |
274 | let (file_id, node) = var.source(db); | 250 | let src = var.source(db); |
275 | NavigationTarget::from_named( | 251 | NavigationTarget::from_named( |
276 | file_id.original_file(db), | 252 | src.file_id.original_file(db), |
277 | &*node, | 253 | &*src.ast, |
278 | node.doc_comment_text(), | 254 | src.ast.doc_comment_text(), |
279 | node.short_label(), | 255 | src.ast.short_label(), |
280 | ) | 256 | ) |
281 | } | 257 | } |
282 | hir::ModuleDef::Trait(e) => { | 258 | hir::ModuleDef::Trait(e) => { |