From 1eb6d2e9a90da9a5738192b60b073b6b71c7deef Mon Sep 17 00:00:00 2001 From: vsrs Date: Tue, 29 Aug 2023 23:06:12 +0700 Subject: [PATCH] Rollback changes in remove_unused_param.rs --- .../src/handlers/remove_unused_param.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/ide-assists/src/handlers/remove_unused_param.rs b/crates/ide-assists/src/handlers/remove_unused_param.rs index aa1002ee393..0772b168d49 100644 --- a/crates/ide-assists/src/handlers/remove_unused_param.rs +++ b/crates/ide-assists/src/handlers/remove_unused_param.rs @@ -42,7 +42,13 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext<'_>) -> param.syntax().parent()?.children().find_map(ast::SelfParam::cast).is_some(); // check if fn is in impl Trait for .. - if is_trait_impl(&func) { + if func + .syntax() + .parent() // AssocItemList + .and_then(|x| x.parent()) + .and_then(ast::Impl::cast) + .map_or(false, |imp| imp.trait_().is_some()) + { cov_mark::hit!(trait_impl); return None; } @@ -81,14 +87,6 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext<'_>) -> ) } -pub(crate) fn is_trait_impl(func: &ast::Fn) -> bool { - func.syntax() - .parent() // AssocItemList - .and_then(|x| x.parent()) - .and_then(ast::Impl::cast) - .map_or(false, |imp| imp.trait_().is_some()) -} - fn process_usages( ctx: &AssistContext<'_>, builder: &mut SourceChangeBuilder,