diff options
Diffstat (limited to 'crates/hir')
-rw-r--r-- | crates/hir/src/has_source.rs | 2 | ||||
-rw-r--r-- | crates/hir/src/lib.rs | 12 | ||||
-rw-r--r-- | crates/hir/src/semantics.rs | 17 |
3 files changed, 10 insertions, 21 deletions
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs index dc10a4d0f..197149c5e 100644 --- a/crates/hir/src/has_source.rs +++ b/crates/hir/src/has_source.rs | |||
@@ -127,7 +127,7 @@ impl HasSource for Impl { | |||
127 | } | 127 | } |
128 | 128 | ||
129 | impl HasSource for TypeParam { | 129 | impl HasSource for TypeParam { |
130 | type Ast = Either<ast::Trait, ast::TypeParam>; | 130 | type Ast = Either<ast::TypeParam, ast::Trait>; |
131 | fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { | 131 | fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> { |
132 | let child_source = self.id.parent.child_source(db.upcast()); | 132 | let child_source = self.id.parent.child_source(db.upcast()); |
133 | Some(child_source.map(|it| it[self.id.local_id].clone())) | 133 | Some(child_source.map(|it| it[self.id.local_id].clone())) |
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 5bc0b2338..b7eabaabb 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -2688,18 +2688,6 @@ impl ScopeDef { | |||
2688 | 2688 | ||
2689 | items | 2689 | items |
2690 | } | 2690 | } |
2691 | |||
2692 | pub fn is_value_def(&self) -> bool { | ||
2693 | matches!( | ||
2694 | self, | ||
2695 | ScopeDef::ModuleDef(ModuleDef::Function(_)) | ||
2696 | | ScopeDef::ModuleDef(ModuleDef::Variant(_)) | ||
2697 | | ScopeDef::ModuleDef(ModuleDef::Const(_)) | ||
2698 | | ScopeDef::ModuleDef(ModuleDef::Static(_)) | ||
2699 | | ScopeDef::GenericParam(GenericParam::ConstParam(_)) | ||
2700 | | ScopeDef::Local(_) | ||
2701 | ) | ||
2702 | } | ||
2703 | } | 2691 | } |
2704 | 2692 | ||
2705 | impl From<ItemInNs> for ScopeDef { | 2693 | impl From<ItemInNs> for ScopeDef { |
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 613266e07..43162797e 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs | |||
@@ -51,12 +51,14 @@ impl PathResolution { | |||
51 | PathResolution::Def(ModuleDef::BuiltinType(builtin)) => { | 51 | PathResolution::Def(ModuleDef::BuiltinType(builtin)) => { |
52 | Some(TypeNs::BuiltinType((*builtin).into())) | 52 | Some(TypeNs::BuiltinType((*builtin).into())) |
53 | } | 53 | } |
54 | PathResolution::Def(ModuleDef::Const(_)) | 54 | PathResolution::Def( |
55 | | PathResolution::Def(ModuleDef::Variant(_)) | 55 | ModuleDef::Const(_) |
56 | | PathResolution::Def(ModuleDef::Function(_)) | 56 | | ModuleDef::Variant(_) |
57 | | PathResolution::Def(ModuleDef::Module(_)) | 57 | | ModuleDef::Function(_) |
58 | | PathResolution::Def(ModuleDef::Static(_)) | 58 | | ModuleDef::Module(_) |
59 | | PathResolution::Def(ModuleDef::Trait(_)) => None, | 59 | | ModuleDef::Static(_) |
60 | | ModuleDef::Trait(_), | ||
61 | ) => None, | ||
60 | PathResolution::Def(ModuleDef::TypeAlias(alias)) => { | 62 | PathResolution::Def(ModuleDef::TypeAlias(alias)) => { |
61 | Some(TypeNs::TypeAliasId((*alias).into())) | 63 | Some(TypeNs::TypeAliasId((*alias).into())) |
62 | } | 64 | } |
@@ -65,8 +67,7 @@ impl PathResolution { | |||
65 | } | 67 | } |
66 | PathResolution::TypeParam(param) => Some(TypeNs::GenericParam((*param).into())), | 68 | PathResolution::TypeParam(param) => Some(TypeNs::GenericParam((*param).into())), |
67 | PathResolution::SelfType(impl_def) => Some(TypeNs::SelfType((*impl_def).into())), | 69 | PathResolution::SelfType(impl_def) => Some(TypeNs::SelfType((*impl_def).into())), |
68 | PathResolution::AssocItem(AssocItem::Const(_)) | 70 | PathResolution::AssocItem(AssocItem::Const(_) | AssocItem::Function(_)) => None, |
69 | | PathResolution::AssocItem(AssocItem::Function(_)) => None, | ||
70 | PathResolution::AssocItem(AssocItem::TypeAlias(alias)) => { | 71 | PathResolution::AssocItem(AssocItem::TypeAlias(alias)) => { |
71 | Some(TypeNs::TypeAliasId((*alias).into())) | 72 | Some(TypeNs::TypeAliasId((*alias).into())) |
72 | } | 73 | } |