diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-19 01:33:49 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-19 01:33:49 +0000 |
commit | 00680a5d7c8f9ab41009d9925cb4c223a86a7615 (patch) | |
tree | a857e7b44a051ce217166de5243d44492ad6d05a /crates/hir | |
parent | 5231f4b27098d3eee621d2b781a92c6f3e9f267b (diff) | |
parent | ca6548827634155f28e75bc6cb2e734d2d5d1e95 (diff) |
Merge #7342
7342: Show deprecated completions for deprecated traits r=kjeremy a=SomeoneToIgnore
TIL that there are two kinds of deprecation tags and a few details about String methods.
<img width="472" alt="Screenshot 2021-01-19 at 01 11 38" src="https://user-images.githubusercontent.com/2690773/104970200-569d3380-59f3-11eb-9ee3-627b3c8a5c9d.png">
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/hir')
-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>>, |