aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-19 01:33:49 +0000
committerGitHub <[email protected]>2021-01-19 01:33:49 +0000
commit00680a5d7c8f9ab41009d9925cb4c223a86a7615 (patch)
treea857e7b44a051ce217166de5243d44492ad6d05a /crates/hir
parent5231f4b27098d3eee621d2b781a92c6f3e9f267b (diff)
parentca6548827634155f28e75bc6cb2e734d2d5d1e95 (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.rs19
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
286impl Module { 277impl 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}
1054impl 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}
1063fn as_assoc_item<ID, DEF, CTOR, AST>(db: &dyn HirDatabase, ctor: CTOR, id: ID) -> Option<AssocItem> 1064fn as_assoc_item<ID, DEF, CTOR, AST>(db: &dyn HirDatabase, ctor: CTOR, id: ID) -> Option<AssocItem>
1064where 1065where
1065 ID: Lookup<Data = AssocItemLoc<AST>>, 1066 ID: Lookup<Data = AssocItemLoc<AST>>,