Replace make with SyntaxFactory in convert_named_struct_to_tuple_struct

This commit is contained in:
bit-aloo
2026-04-20 08:37:35 +05:30
parent a5fb3511f7
commit 27c4d58747
@@ -99,21 +99,20 @@ fn edit_struct_def(
) {
// Note that we don't need to consider macro files in this function because this is
// currently not triggered for struct definitions inside macro calls.
let editor = builder.make_editor(strukt.syntax());
let make = editor.make();
let tuple_fields = record_fields.fields().filter_map(|f| {
let (editor, field) =
SyntaxEditor::with_ast_node(&ast::make::tuple_field(f.visibility(), f.ty()?));
editor.insert_all(
let (field_editor, field) =
SyntaxEditor::with_ast_node(&make.tuple_field(f.visibility(), f.ty()?));
field_editor.insert_all(
Position::first_child_of(field.syntax()),
f.attrs().map(|attr| attr.syntax().clone().into()).collect(),
);
let field_syntax = editor.finish().new_root().clone();
let field = ast::TupleField::cast(field_syntax)?;
Some(field)
let field_syntax = field_editor.finish().new_root().clone();
ast::TupleField::cast(field_syntax)
});
let editor = builder.make_editor(strukt.syntax());
let make = editor.make();
let tuple_fields = make.tuple_field_list(tuple_fields);
let mut elements = vec![tuple_fields.syntax().clone().into()];