From 1578375b89848b98a4d5187aaf794bc227d1eda6 Mon Sep 17 00:00:00 2001 From: kjeremy Date: Mon, 4 Mar 2019 09:49:18 -0500 Subject: [PATCH] Make ExpOrPatId private --- crates/ra_hir/src/ty/infer.rs | 9 ++++++--- 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 792d021327b..40559c3de7a 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 { } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum ExprOrPatId { +enum ExprOrPatId { Expr(ExprId), Pat(PatId), } @@ -93,8 +93,11 @@ impl InferenceResult { pub fn field_resolution(&self, expr: ExprId) -> Option { self.field_resolutions.get(&expr).map(|it| *it) } - pub fn assoc_resolutions(&self, id: ExprOrPatId) -> Option { - self.assoc_resolutions.get(&id).map(|it| *it) + pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option { + self.assoc_resolutions.get(&id.into()).map(|it| *it) + } + pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option { + self.assoc_resolutions.get(&id.into()).map(|it| *it) } } diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index f16c3bda4bb..364263d9bba 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( if let Some(res) = source_map .node_expr(expr) - .and_then(|it| infer_result.assoc_resolutions(it.into())) + .and_then(|it| infer_result.assoc_resolutions_for_expr(it.into())) { return Exact(NavigationTarget::from_impl_item(db, res)); }