diff options
author | Kirill Bulatov <[email protected]> | 2021-01-18 23:08:59 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2021-01-18 23:08:59 +0000 |
commit | ca6548827634155f28e75bc6cb2e734d2d5d1e95 (patch) | |
tree | 49e2050fb27937c02768954e94bcd3b4006ed3d3 /crates/hir/src | |
parent | cc663a7b0c1fc813c58be8b8d84772c52f736d26 (diff) |
Show deprecated completions for deprecated traits
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/code_model.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 2950f08b8..5a4c27906 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs | |||
@@ -272,15 +272,6 @@ impl ModuleDef { | |||
272 | 272 | ||
273 | hir_ty::diagnostics::validate_module_item(db, module.id.krate, id, sink) | 273 | hir_ty::diagnostics::validate_module_item(db, module.id.krate, id, sink) |
274 | } | 274 | } |
275 | |||
276 | pub fn as_assoc_item(self, db: &dyn HirDatabase) -> Option<AssocItem> { | ||
277 | match self { | ||
278 | ModuleDef::Function(f) => f.as_assoc_item(db), | ||
279 | ModuleDef::Const(c) => c.as_assoc_item(db), | ||
280 | ModuleDef::TypeAlias(t) => t.as_assoc_item(db), | ||
281 | _ => None, | ||
282 | } | ||
283 | } | ||
284 | } | 275 | } |
285 | 276 | ||
286 | impl Module { | 277 | impl Module { |
@@ -1060,6 +1051,16 @@ impl AsAssocItem for TypeAlias { | |||
1060 | as_assoc_item(db, AssocItem::TypeAlias, self.id) | 1051 | as_assoc_item(db, AssocItem::TypeAlias, self.id) |
1061 | } | 1052 | } |
1062 | } | 1053 | } |
1054 | impl AsAssocItem for ModuleDef { | ||
1055 | fn as_assoc_item(self, db: &dyn HirDatabase) -> Option<AssocItem> { | ||
1056 | match self { | ||
1057 | ModuleDef::Function(it) => it.as_assoc_item(db), | ||
1058 | ModuleDef::Const(it) => it.as_assoc_item(db), | ||
1059 | ModuleDef::TypeAlias(it) => it.as_assoc_item(db), | ||
1060 | _ => None, | ||
1061 | } | ||
1062 | } | ||
1063 | } | ||
1063 | fn as_assoc_item<ID, DEF, CTOR, AST>(db: &dyn HirDatabase, ctor: CTOR, id: ID) -> Option<AssocItem> | 1064 | fn as_assoc_item<ID, DEF, CTOR, AST>(db: &dyn HirDatabase, ctor: CTOR, id: ID) -> Option<AssocItem> |
1064 | where | 1065 | where |
1065 | ID: Lookup<Data = AssocItemLoc<AST>>, | 1066 | ID: Lookup<Data = AssocItemLoc<AST>>, |