fix: update introduce_named_generic to use type_param directly

Signed-off-by: Tarek <tareknaser360@gmail.com>
This commit is contained in:
Tarek 2024-12-04 16:02:03 +02:00
parent 9157761f5d
commit b7e613c0dc
No known key found for this signature in database
GPG key ID: 58C48198E7CC6EBD

View file

@ -50,11 +50,10 @@ pub(crate) fn introduce_named_generic(acc: &mut Assists, ctx: &AssistContext<'_>
let new_ty = make.ty(&type_param_name);
editor.replace(impl_trait_type.syntax(), new_ty.syntax());
let generic_param = syntax::ast::GenericParam::from(type_param);
editor.syntax_editor_add_generic_param(fn_, generic_param.clone());
editor.syntax_editor_add_generic_param(fn_, type_param.clone().into());
if let Some(cap) = ctx.config.snippet_cap {
editor.add_annotation(generic_param.syntax(), builder.make_tabstop_before(cap));
editor.add_annotation(type_param.syntax(), builder.make_tabstop_before(cap));
}
editor.add_mappings(make.finish_with_mappings());