use itertools::Itertools;
use stdx::to_lower_snake_case;
-use syntax::ast::VisibilityOwner;
-use syntax::ast::{self, AstNode, NameOwner};
+use syntax::ast::HasVisibility;
+use syntax::ast::{self, AstNode, HasName};
use crate::{
utils::{add_method_to_adt, find_struct_impl},
ast::StructKind::Unit => return None,
};
- let fn_name = format!("{}_{}", props.fn_name_prefix, &to_lower_snake_case(variant_name.text()));
+ let fn_name =
+ format!("{}_{}", props.fn_name_prefix, &to_lower_snake_case(&variant_name.text()));
// Return early if we've found an existing new fn
- let impl_def = find_struct_impl(&ctx, &parent_enum, &fn_name)?;
+ let impl_def = find_struct_impl(ctx, &parent_enum, &fn_name)?;
let target = variant.syntax().text_range();
acc.add(AssistId(assist_id, AssistKind::Generate), assist_description, target, |builder| {