@@ -35,7 +35,7 @@ fn gen_clone_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
3535 stdx:: always!( func. name( ) . is_some_and( |name| name. text( ) == "clone" ) ) ;
3636 fn gen_clone_call ( target : ast:: Expr ) -> ast:: Expr {
3737 let method = make:: name_ref ( "clone" ) ;
38- make:: expr_method_call ( target, method, make:: arg_list ( None ) )
38+ make:: expr_method_call ( target, method, make:: arg_list ( None ) ) . into ( )
3939 }
4040 let expr = match adt {
4141 // `Clone` cannot be derived for unions, so no default impl can be provided.
@@ -165,7 +165,7 @@ fn gen_debug_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
165165 let method = make:: name_ref ( "debug_struct" ) ;
166166 let struct_name = format ! ( "\" {name}\" " ) ;
167167 let args = make:: arg_list ( Some ( make:: expr_literal ( & struct_name) . into ( ) ) ) ;
168- let mut expr = make:: expr_method_call ( target, method, args) ;
168+ let mut expr = make:: expr_method_call ( target, method, args) . into ( ) ;
169169
170170 let mut pats = vec ! [ ] ;
171171 for field in list. fields ( ) {
@@ -181,12 +181,13 @@ fn gen_debug_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
181181 let path = & format ! ( "{field_name}" ) ;
182182 let path = make:: expr_path ( make:: ext:: ident_path ( path) ) ;
183183 let args = make:: arg_list ( vec ! [ name, path] ) ;
184- expr = make:: expr_method_call ( expr, method_name, args) ;
184+ expr = make:: expr_method_call ( expr, method_name, args) . into ( ) ;
185185 }
186186
187187 // => <expr>.finish()
188188 let method = make:: name_ref ( "finish" ) ;
189- let expr = make:: expr_method_call ( expr, method, make:: arg_list ( None ) ) ;
189+ let expr =
190+ make:: expr_method_call ( expr, method, make:: arg_list ( None ) ) . into ( ) ;
190191
191192 // => MyStruct { fields.. } => f.debug_struct("MyStruct")...finish(),
192193 let pat = make:: record_pat ( variant_name. clone ( ) , pats. into_iter ( ) ) ;
@@ -198,7 +199,7 @@ fn gen_debug_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
198199 let method = make:: name_ref ( "debug_tuple" ) ;
199200 let struct_name = format ! ( "\" {name}\" " ) ;
200201 let args = make:: arg_list ( Some ( make:: expr_literal ( & struct_name) . into ( ) ) ) ;
201- let mut expr = make:: expr_method_call ( target, method, args) ;
202+ let mut expr = make:: expr_method_call ( target, method, args) . into ( ) ;
202203
203204 let mut pats = vec ! [ ] ;
204205 for ( i, _) in list. fields ( ) . enumerate ( ) {
@@ -214,12 +215,13 @@ fn gen_debug_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
214215 let field_path = & name. to_string ( ) ;
215216 let field_path = make:: expr_path ( make:: ext:: ident_path ( field_path) ) ;
216217 let args = make:: arg_list ( vec ! [ field_path] ) ;
217- expr = make:: expr_method_call ( expr, method_name, args) ;
218+ expr = make:: expr_method_call ( expr, method_name, args) . into ( ) ;
218219 }
219220
220221 // => <expr>.finish()
221222 let method = make:: name_ref ( "finish" ) ;
222- let expr = make:: expr_method_call ( expr, method, make:: arg_list ( None ) ) ;
223+ let expr =
224+ make:: expr_method_call ( expr, method, make:: arg_list ( None ) ) . into ( ) ;
223225
224226 // => MyStruct (fields..) => f.debug_tuple("MyStruct")...finish(),
225227 let pat = make:: tuple_struct_pat ( variant_name. clone ( ) , pats. into_iter ( ) ) ;
@@ -254,41 +256,42 @@ fn gen_debug_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
254256
255257 let expr = match strukt. field_list ( ) {
256258 // => f.debug_struct("Name").finish()
257- None => make:: expr_method_call ( target, make:: name_ref ( "debug_struct" ) , args) ,
259+ None => make:: expr_method_call ( target, make:: name_ref ( "debug_struct" ) , args) . into ( ) ,
258260
259261 // => f.debug_struct("Name").field("foo", &self.foo).finish()
260262 Some ( ast:: FieldList :: RecordFieldList ( field_list) ) => {
261263 let method = make:: name_ref ( "debug_struct" ) ;
262- let mut expr = make:: expr_method_call ( target, method, args) ;
264+ let mut expr = make:: expr_method_call ( target, method, args) . into ( ) ;
263265 for field in field_list. fields ( ) {
264266 let name = field. name ( ) ?;
265267 let f_name = make:: expr_literal ( & ( format ! ( "\" {name}\" " ) ) ) . into ( ) ;
266268 let f_path = make:: expr_path ( make:: ext:: ident_path ( "self" ) ) ;
267269 let f_path = make:: expr_ref ( f_path, false ) ;
268270 let f_path = make:: expr_field ( f_path, & format ! ( "{name}" ) ) ;
269271 let args = make:: arg_list ( [ f_name, f_path] ) ;
270- expr = make:: expr_method_call ( expr, make:: name_ref ( "field" ) , args) ;
272+ expr = make:: expr_method_call ( expr, make:: name_ref ( "field" ) , args) . into ( ) ;
271273 }
272274 expr
273275 }
274276
275277 // => f.debug_tuple("Name").field(self.0).finish()
276278 Some ( ast:: FieldList :: TupleFieldList ( field_list) ) => {
277279 let method = make:: name_ref ( "debug_tuple" ) ;
278- let mut expr = make:: expr_method_call ( target, method, args) ;
280+ let mut expr = make:: expr_method_call ( target, method, args) . into ( ) ;
279281 for ( i, _) in field_list. fields ( ) . enumerate ( ) {
280282 let f_path = make:: expr_path ( make:: ext:: ident_path ( "self" ) ) ;
281283 let f_path = make:: expr_ref ( f_path, false ) ;
282284 let f_path = make:: expr_field ( f_path, & format ! ( "{i}" ) ) ;
283285 let method = make:: name_ref ( "field" ) ;
284- expr = make:: expr_method_call ( expr, method, make:: arg_list ( Some ( f_path) ) ) ;
286+ expr = make:: expr_method_call ( expr, method, make:: arg_list ( Some ( f_path) ) )
287+ . into ( ) ;
285288 }
286289 expr
287290 }
288291 } ;
289292
290293 let method = make:: name_ref ( "finish" ) ;
291- let expr = make:: expr_method_call ( expr, method, make:: arg_list ( None ) ) ;
294+ let expr = make:: expr_method_call ( expr, method, make:: arg_list ( None ) ) . into ( ) ;
292295 let body = make:: block_expr ( None , Some ( expr) ) . indent ( ast:: edit:: IndentLevel ( 1 ) ) ;
293296 ted:: replace ( func. body ( ) ?. syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
294297 Some ( ( ) )
@@ -348,7 +351,7 @@ fn gen_hash_impl(adt: &ast::Adt, func: &ast::Fn) -> Option<()> {
348351 fn gen_hash_call ( target : ast:: Expr ) -> ast:: Stmt {
349352 let method = make:: name_ref ( "hash" ) ;
350353 let arg = make:: expr_path ( make:: ext:: ident_path ( "state" ) ) ;
351- let expr = make:: expr_method_call ( target, method, make:: arg_list ( Some ( arg) ) ) ;
354+ let expr = make:: expr_method_call ( target, method, make:: arg_list ( Some ( arg) ) ) . into ( ) ;
352355 make:: expr_stmt ( expr) . into ( )
353356 }
354357
@@ -613,7 +616,7 @@ fn gen_partial_ord(adt: &ast::Adt, func: &ast::Fn, trait_ref: Option<TraitRef>)
613616 fn gen_partial_cmp_call ( lhs : ast:: Expr , rhs : ast:: Expr ) -> ast:: Expr {
614617 let rhs = make:: expr_ref ( rhs, false ) ;
615618 let method = make:: name_ref ( "partial_cmp" ) ;
616- make:: expr_method_call ( lhs, method, make:: arg_list ( Some ( rhs) ) )
619+ make:: expr_method_call ( lhs, method, make:: arg_list ( Some ( rhs) ) ) . into ( )
617620 }
618621
619622 // Check that self type and rhs type match. We don't know how to implement the method
0 commit comments