Unnamed repository; edit this file 'description' to name the repository.
Rollback changes in remove_unused_param.rs
vsrs 2023-08-29
parent 6b559c4 · commit 1eb6d2e
-rw-r--r--crates/ide-assists/src/handlers/remove_unused_param.rs16
1 files 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 aa1002ee39..0772b168d4 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,