Skip to content

Commit 1eb6d2e

Browse files
committed
Rollback changes in remove_unused_param.rs
1 parent 6b559c4 commit 1eb6d2e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

crates/ide-assists/src/handlers/remove_unused_param.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext<'_>) ->
4242
param.syntax().parent()?.children().find_map(ast::SelfParam::cast).is_some();
4343

4444
// check if fn is in impl Trait for ..
45-
if is_trait_impl(&func) {
45+
if func
46+
.syntax()
47+
.parent() // AssocItemList
48+
.and_then(|x| x.parent())
49+
.and_then(ast::Impl::cast)
50+
.map_or(false, |imp| imp.trait_().is_some())
51+
{
4652
cov_mark::hit!(trait_impl);
4753
return None;
4854
}
@@ -81,14 +87,6 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext<'_>) ->
8187
)
8288
}
8389

84-
pub(crate) fn is_trait_impl(func: &ast::Fn) -> bool {
85-
func.syntax()
86-
.parent() // AssocItemList
87-
.and_then(|x| x.parent())
88-
.and_then(ast::Impl::cast)
89-
.map_or(false, |imp| imp.trait_().is_some())
90-
}
91-
9290
fn process_usages(
9391
ctx: &AssistContext<'_>,
9492
builder: &mut SourceChangeBuilder,

0 commit comments

Comments
 (0)