diff options
author | Aleksey Kladov <[email protected]> | 2019-11-27 14:46:02 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-27 18:16:00 +0000 |
commit | a87579500a2c35597071efd0ad6983927f0c1815 (patch) | |
tree | 9805b3dcbf8d767b2fc0623f42794068f3660d44 /crates/ra_ide_api | |
parent | 368653081558ab389c6543d6b5027859e26beb3b (diff) |
Move Ty
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/impls.rs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/crates/ra_ide_api/src/impls.rs b/crates/ra_ide_api/src/impls.rs index b3ebd9145..aa480e399 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::{ApplicationTy, FromSource, ImplBlock, Ty, TypeCtor}; | 3 | use hir::{FromSource, ImplBlock}; |
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 | ||
@@ -61,7 +61,7 @@ fn impls_for_def( | |||
61 | Some( | 61 | Some( |
62 | impls | 62 | impls |
63 | .into_iter() | 63 | .into_iter() |
64 | .filter(|impl_block| is_equal_for_find_impls(&ty, &impl_block.target_ty(db))) | 64 | .filter(|impl_block| ty.is_equal_for_find_impls(&impl_block.target_ty(db))) |
65 | .map(|imp| imp.to_nav(db)) | 65 | .map(|imp| imp.to_nav(db)) |
66 | .collect(), | 66 | .collect(), |
67 | ) | 67 | ) |
@@ -82,19 +82,6 @@ fn impls_for_trait( | |||
82 | Some(impls.into_iter().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 { | ||
86 | match (original_ty, impl_ty) { | ||
87 | (Ty::Apply(a_original_ty), Ty::Apply(ApplicationTy { ctor, parameters })) => match ctor { | ||
88 | TypeCtor::Ref(..) => match parameters.as_single() { | ||
89 | Ty::Apply(a_ty) => a_original_ty.ctor == a_ty.ctor, | ||
90 | _ => false, | ||
91 | }, | ||
92 | _ => a_original_ty.ctor == *ctor, | ||
93 | }, | ||
94 | _ => false, | ||
95 | } | ||
96 | } | ||
97 | |||
98 | #[cfg(test)] | 85 | #[cfg(test)] |
99 | mod tests { | 86 | mod tests { |
100 | use crate::mock_analysis::analysis_and_position; | 87 | use crate::mock_analysis::analysis_and_position; |