about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvsrs <vit@conrlab.com>2023-08-29 23:06:12 +0700
committervsrs <vit@conrlab.com>2023-08-29 23:06:12 +0700
commit1eb6d2e9a90da9a5738192b60b073b6b71c7deef (patch)
tree9cad5ef003903a6d8c12ca4019fa962e1a85924f
parent6b559c4a9aabeb151678479265e4d82018fedaeb (diff)
downloadrust-1eb6d2e9a90da9a5738192b60b073b6b71c7deef.tar.gz
rust-1eb6d2e9a90da9a5738192b60b073b6b71c7deef.zip
Rollback changes in remove_unused_param.rs
-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 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,