diff options
author | Aleksey Kladov <[email protected]> | 2019-11-26 12:27:33 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-26 12:36:25 +0000 |
commit | 45d05ed78384b28fbd341068f36912a2e0308292 (patch) | |
tree | 5b7f7abfc59e6e832be7fb0b22b3dcc704de946c /crates/ra_ide_api/src | |
parent | 4c43631829d8bac8b7533c994d8cf1241a95ce70 (diff) |
id-ify impls_in_crate_query
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/impls.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs index 2b3100fc3..b3ebd9145 100644 --- a/crates/ra_ide_api/src/impls.rs +++ b/crates/ra_ide_api/src/impls.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir::{db::HirDatabase, ApplicationTy, FromSource, Ty, TypeCtor}; | 3 | use hir::{ApplicationTy, FromSource, ImplBlock, Ty, TypeCtor}; |
4 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
5 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; | 5 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; |
6 | 6 | ||
@@ -56,11 +56,11 @@ fn impls_for_def( | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | let krate = module.krate(); | 58 | let krate = module.krate(); |
59 | let impls = db.impls_in_crate(krate); | 59 | let impls = ImplBlock::all_in_crate(db, krate); |
60 | 60 | ||
61 | Some( | 61 | Some( |
62 | impls | 62 | impls |
63 | .all_impls() | 63 | .into_iter() |
64 | .filter(|impl_block| is_equal_for_find_impls(&ty, &impl_block.target_ty(db))) | 64 | .filter(|impl_block| is_equal_for_find_impls(&ty, &impl_block.target_ty(db))) |
65 | .map(|imp| imp.to_nav(db)) | 65 | .map(|imp| imp.to_nav(db)) |
66 | .collect(), | 66 | .collect(), |
@@ -77,9 +77,9 @@ fn impls_for_trait( | |||
77 | let tr = hir::Trait::from_source(db, src)?; | 77 | let tr = hir::Trait::from_source(db, src)?; |
78 | 78 | ||
79 | let krate = module.krate(); | 79 | let krate = module.krate(); |
80 | let impls = db.impls_in_crate(krate); | 80 | let impls = ImplBlock::for_trait(db, krate, tr); |
81 | 81 | ||
82 | Some(impls.lookup_impl_blocks_for_trait(tr).map(|imp| imp.to_nav(db)).collect()) | 82 | Some(impls.into_iter().map(|imp| imp.to_nav(db)).collect()) |
83 | } | 83 | } |
84 | 84 | ||
85 | fn is_equal_for_find_impls(original_ty: &Ty, impl_ty: &Ty) -> bool { | 85 | fn is_equal_for_find_impls(original_ty: &Ty, impl_ty: &Ty) -> bool { |