aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/goto_definition.rs
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-03-17 18:37:09 +0000
committerFlorian Diebold <[email protected]>2019-03-21 21:17:00 +0000
commit8a5fbf471305894094726834f7701747fce9c961 (patch)
treed210d1a25099ca381bac2f0f2f3247fbd69b366d /crates/ra_ide_api/src/goto_definition.rs
parent7a8ba535422a4e3d2b649acde75b5c400ef5e7c6 (diff)
Remove the old variants replaced by Ty::Apply
Diffstat (limited to 'crates/ra_ide_api/src/goto_definition.rs')
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index d4e10b69c..f94487d94 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -87,14 +87,12 @@ pub(crate) fn reference_definition(
87 87
88 if let Some(expr) = struct_lit.and_then(|lit| source_map.node_expr(lit.into())) { 88 if let Some(expr) = struct_lit.and_then(|lit| source_map.node_expr(lit.into())) {
89 let ty = infer_result[expr].clone(); 89 let ty = infer_result[expr].clone();
90 if let hir::Ty::Adt { def_id, .. } = ty { 90 if let Some((hir::AdtDef::Struct(s), _)) = ty.as_adt() {
91 if let hir::AdtDef::Struct(s) = def_id { 91 let hir_path = hir::Path::from_name_ref(name_ref);
92 let hir_path = hir::Path::from_name_ref(name_ref); 92 let hir_name = hir_path.as_ident().unwrap();
93 let hir_name = hir_path.as_ident().unwrap();
94 93
95 if let Some(field) = s.field(db, hir_name) { 94 if let Some(field) = s.field(db, hir_name) {
96 return Exact(NavigationTarget::from_field(db, field)); 95 return Exact(NavigationTarget::from_field(db, field));
97 }
98 } 96 }
99 } 97 }
100 } 98 }
@@ -124,7 +122,7 @@ pub(crate) fn reference_definition(
124 Some(Resolution::SelfType(impl_block)) => { 122 Some(Resolution::SelfType(impl_block)) => {
125 let ty = impl_block.target_ty(db); 123 let ty = impl_block.target_ty(db);
126 124
127 if let hir::Ty::Adt { def_id, .. } = ty { 125 if let Some((def_id, _)) = ty.as_adt() {
128 return Exact(NavigationTarget::from_adt_def(db, def_id)); 126 return Exact(NavigationTarget::from_adt_def(db, def_id));
129 } 127 }
130 } 128 }