Rollback changes in remove_unused_param.rs

This commit is contained in:
vsrs 2023-08-29 23:06:12 +07:00
parent 6b559c4a9a
commit 1eb6d2e9a9

View File

@ -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,