Make ExpOrPatId private

This commit is contained in:
kjeremy 2019-03-04 09:49:18 -05:00
parent 79f61dcb0e
commit 1578375b89
2 changed files with 7 additions and 4 deletions

View File

@ -56,7 +56,7 @@ pub fn infer(db: &impl HirDatabase, func: Function) -> Arc<InferenceResult> {
}
#[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<StructField> {
self.field_resolutions.get(&expr).map(|it| *it)
}
pub fn assoc_resolutions(&self, id: ExprOrPatId) -> Option<ImplItem> {
self.assoc_resolutions.get(&id).map(|it| *it)
pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option<ImplItem> {
self.assoc_resolutions.get(&id.into()).map(|it| *it)
}
pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option<ImplItem> {
self.assoc_resolutions.get(&id.into()).map(|it| *it)
}
}

View File

@ -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));
}