diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-26 12:42:15 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-26 12:42:15 +0000 |
commit | 36dca8de93c07be62724f973aa4c8a045941d218 (patch) | |
tree | dbe3d521c869aa12c922098e9544859343494a0e /crates/ra_ide_api/src | |
parent | 280946e597f880709d2dc2e12eb9a6db3223d979 (diff) | |
parent | 4e17718a9aaba34533ba6a46d52b4aa959c662c7 (diff) |
Merge #2410
2410: Introduce hir_ty r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
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 { |