aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/semantics.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index e6a7aaee0..2f42f877c 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -43,11 +43,11 @@ pub enum PathResolution {
43} 43}
44 44
45impl PathResolution { 45impl PathResolution {
46 fn in_type_ns(self) -> Option<TypeNs> { 46 fn in_type_ns(&self) -> Option<TypeNs> {
47 match self { 47 match self {
48 PathResolution::Def(ModuleDef::Adt(adt)) => Some(TypeNs::AdtId(adt.into())), 48 PathResolution::Def(ModuleDef::Adt(adt)) => Some(TypeNs::AdtId((*adt).into())),
49 PathResolution::Def(ModuleDef::BuiltinType(builtin)) => { 49 PathResolution::Def(ModuleDef::BuiltinType(builtin)) => {
50 Some(TypeNs::BuiltinType(builtin)) 50 Some(TypeNs::BuiltinType(*builtin))
51 } 51 }
52 PathResolution::Def(ModuleDef::Const(_)) => None, 52 PathResolution::Def(ModuleDef::Const(_)) => None,
53 PathResolution::Def(ModuleDef::EnumVariant(_)) => None, 53 PathResolution::Def(ModuleDef::EnumVariant(_)) => None,
@@ -56,16 +56,16 @@ impl PathResolution {
56 PathResolution::Def(ModuleDef::Static(_)) => None, 56 PathResolution::Def(ModuleDef::Static(_)) => None,
57 PathResolution::Def(ModuleDef::Trait(_)) => None, 57 PathResolution::Def(ModuleDef::Trait(_)) => None,
58 PathResolution::Def(ModuleDef::TypeAlias(alias)) => { 58 PathResolution::Def(ModuleDef::TypeAlias(alias)) => {
59 Some(TypeNs::TypeAliasId(alias.into())) 59 Some(TypeNs::TypeAliasId((*alias).into()))
60 } 60 }
61 PathResolution::Local(_) => None, 61 PathResolution::Local(_) => None,
62 PathResolution::TypeParam(param) => Some(TypeNs::GenericParam(param.into())), 62 PathResolution::TypeParam(param) => Some(TypeNs::GenericParam((*param).into())),
63 PathResolution::SelfType(impl_def) => Some(TypeNs::SelfType(impl_def.into())), 63 PathResolution::SelfType(impl_def) => Some(TypeNs::SelfType((*impl_def).into())),
64 PathResolution::Macro(_) => None, 64 PathResolution::Macro(_) => None,
65 PathResolution::AssocItem(AssocItem::Const(_)) => None, 65 PathResolution::AssocItem(AssocItem::Const(_)) => None,
66 PathResolution::AssocItem(AssocItem::Function(_)) => None, 66 PathResolution::AssocItem(AssocItem::Function(_)) => None,
67 PathResolution::AssocItem(AssocItem::TypeAlias(alias)) => { 67 PathResolution::AssocItem(AssocItem::TypeAlias(alias)) => {
68 Some(TypeNs::TypeAliasId(alias.into())) 68 Some(TypeNs::TypeAliasId((*alias).into()))
69 } 69 }
70 } 70 }
71 } 71 }
@@ -77,7 +77,7 @@ impl PathResolution {
77 db: &dyn HirDatabase, 77 db: &dyn HirDatabase,
78 mut cb: impl FnMut(TypeAlias) -> Option<R>, 78 mut cb: impl FnMut(TypeAlias) -> Option<R>,
79 ) -> Option<R> { 79 ) -> Option<R> {
80 if let Some(res) = self.clone().in_type_ns() { 80 if let Some(res) = self.in_type_ns() {
81 associated_type_shorthand_candidates(db, res, |_, _, id| cb(id.into())) 81 associated_type_shorthand_candidates(db, res, |_, _, id| cb(id.into()))
82 } else { 82 } else {
83 None 83 None