From a87579500a2c35597071efd0ad6983927f0c1815 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 27 Nov 2019 17:46:02 +0300 Subject: Move Ty --- crates/ra_ide_api/src/impls.rs | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'crates/ra_ide_api/src/impls.rs') 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 @@ //! FIXME: write short doc here -use hir::{ApplicationTy, FromSource, ImplBlock, Ty, TypeCtor}; +use hir::{FromSource, ImplBlock}; use ra_db::SourceDatabase; use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; @@ -61,7 +61,7 @@ fn impls_for_def( Some( impls .into_iter() - .filter(|impl_block| is_equal_for_find_impls(&ty, &impl_block.target_ty(db))) + .filter(|impl_block| ty.is_equal_for_find_impls(&impl_block.target_ty(db))) .map(|imp| imp.to_nav(db)) .collect(), ) @@ -82,19 +82,6 @@ fn impls_for_trait( Some(impls.into_iter().map(|imp| imp.to_nav(db)).collect()) } -fn is_equal_for_find_impls(original_ty: &Ty, impl_ty: &Ty) -> bool { - match (original_ty, impl_ty) { - (Ty::Apply(a_original_ty), Ty::Apply(ApplicationTy { ctor, parameters })) => match ctor { - TypeCtor::Ref(..) => match parameters.as_single() { - Ty::Apply(a_ty) => a_original_ty.ctor == a_ty.ctor, - _ => false, - }, - _ => a_original_ty.ctor == *ctor, - }, - _ => false, - } -} - #[cfg(test)] mod tests { use crate::mock_analysis::analysis_and_position; -- cgit v1.2.3