File tree Expand file tree Collapse file tree
crates/ide-assists/src/handlers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,21 +99,20 @@ fn edit_struct_def(
9999) {
100100 // Note that we don't need to consider macro files in this function because this is
101101 // currently not triggered for struct definitions inside macro calls.
102+ let editor = builder. make_editor ( strukt. syntax ( ) ) ;
103+ let make = editor. make ( ) ;
104+
102105 let tuple_fields = record_fields. fields ( ) . filter_map ( |f| {
103- let ( editor , field) =
104- SyntaxEditor :: with_ast_node ( & ast :: make:: tuple_field ( f. visibility ( ) , f. ty ( ) ?) ) ;
105- editor . insert_all (
106+ let ( field_editor , field) =
107+ SyntaxEditor :: with_ast_node ( & make. tuple_field ( f. visibility ( ) , f. ty ( ) ?) ) ;
108+ field_editor . insert_all (
106109 Position :: first_child_of ( field. syntax ( ) ) ,
107110 f. attrs ( ) . map ( |attr| attr. syntax ( ) . clone ( ) . into ( ) ) . collect ( ) ,
108111 ) ;
109- let field_syntax = editor. finish ( ) . new_root ( ) . clone ( ) ;
110- let field = ast:: TupleField :: cast ( field_syntax) ?;
111- Some ( field)
112+ let field_syntax = field_editor. finish ( ) . new_root ( ) . clone ( ) ;
113+ ast:: TupleField :: cast ( field_syntax)
112114 } ) ;
113115
114- let editor = builder. make_editor ( strukt. syntax ( ) ) ;
115- let make = editor. make ( ) ;
116-
117116 let tuple_fields = make. tuple_field_list ( tuple_fields) ;
118117
119118 let mut elements = vec ! [ tuple_fields. syntax( ) . clone( ) . into( ) ] ;
You can’t perform that action at this time.
0 commit comments