diff options
author | kjeremy <[email protected]> | 2019-03-04 14:49:18 +0000 |
---|---|---|
committer | kjeremy <[email protected]> | 2019-03-04 14:49:18 +0000 |
commit | 1578375b89848b98a4d5187aaf794bc227d1eda6 (patch) | |
tree | 973b21649fd2bc64a2e693212df42e35dd21c0c7 | |
parent | 79f61dcb0e3de873c4685c9abaaf4ec5af748000 (diff) |
Make ExpOrPatId private
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 9 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 792d02132..40559c3de 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -56,7 +56,7 @@ pub fn infer(db: &impl HirDatabase, func: Function) -> Arc<InferenceResult> { | |||
56 | } | 56 | } |
57 | 57 | ||
58 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] | 58 | #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] |
59 | pub enum ExprOrPatId { | 59 | enum ExprOrPatId { |
60 | Expr(ExprId), | 60 | Expr(ExprId), |
61 | Pat(PatId), | 61 | Pat(PatId), |
62 | } | 62 | } |
@@ -93,8 +93,11 @@ impl InferenceResult { | |||
93 | pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> { | 93 | pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> { |
94 | self.field_resolutions.get(&expr).map(|it| *it) | 94 | self.field_resolutions.get(&expr).map(|it| *it) |
95 | } | 95 | } |
96 | pub fn assoc_resolutions(&self, id: ExprOrPatId) -> Option<ImplItem> { | 96 | pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option<ImplItem> { |
97 | self.assoc_resolutions.get(&id).map(|it| *it) | 97 | self.assoc_resolutions.get(&id.into()).map(|it| *it) |
98 | } | ||
99 | pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option<ImplItem> { | ||
100 | self.assoc_resolutions.get(&id.into()).map(|it| *it) | ||
98 | } | 101 | } |
99 | } | 102 | } |
100 | 103 | ||
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index f16c3bda4..364263d9b 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -136,7 +136,7 @@ pub(crate) fn reference_definition( | |||
136 | 136 | ||
137 | if let Some(res) = source_map | 137 | if let Some(res) = source_map |
138 | .node_expr(expr) | 138 | .node_expr(expr) |
139 | .and_then(|it| infer_result.assoc_resolutions(it.into())) | 139 | .and_then(|it| infer_result.assoc_resolutions_for_expr(it.into())) |
140 | { | 140 | { |
141 | return Exact(NavigationTarget::from_impl_item(db, res)); | 141 | return Exact(NavigationTarget::from_impl_item(db, res)); |
142 | } | 142 | } |