@@ -536,34 +536,32 @@ fn expand_format_args<'hir>(
536536
537537 let call = if let Some ( format_options) = format_options {
538538 // Generate:
539- // <core::fmt::Arguments>::new_v1_formatted(
540- // lit_pieces,
541- // args,
542- // format_options,
543- // unsafe { ::core::fmt::UnsafeArg::new() }
544- // )
539+ // unsafe {
540+ // <core::fmt::Arguments>::new_v1_formatted(
541+ // lit_pieces,
542+ // args,
543+ // format_options,
544+ // )
545+ // }
545546 let new_v1_formatted = ctx. arena . alloc ( ctx. expr_lang_item_type_relative (
546547 macsp,
547548 hir:: LangItem :: FormatArguments ,
548549 sym:: new_v1_formatted,
549550 ) ) ;
550- let unsafe_arg_new = ctx. arena . alloc ( ctx. expr_lang_item_type_relative (
551- macsp,
552- hir:: LangItem :: FormatUnsafeArg ,
553- sym:: new,
554- ) ) ;
555- let unsafe_arg_new_call = ctx. expr_call ( macsp, unsafe_arg_new, & [ ] ) ;
551+ let args = ctx. arena . alloc_from_iter ( [ lit_pieces, args, format_options] ) ;
552+ let call = ctx. expr_call ( macsp, new_v1_formatted, args) ;
556553 let hir_id = ctx. next_id ( ) ;
557- let unsafe_arg = ctx. expr_block ( ctx. arena . alloc ( hir:: Block {
558- stmts : & [ ] ,
559- expr : Some ( unsafe_arg_new_call) ,
560- hir_id,
561- rules : hir:: BlockCheckMode :: UnsafeBlock ( hir:: UnsafeSource :: CompilerGenerated ) ,
562- span : macsp,
563- targeted_by_break : false ,
564- } ) ) ;
565- let args = ctx. arena . alloc_from_iter ( [ lit_pieces, args, format_options, unsafe_arg] ) ;
566- hir:: ExprKind :: Call ( new_v1_formatted, args)
554+ hir:: ExprKind :: Block (
555+ ctx. arena . alloc ( hir:: Block {
556+ stmts : & [ ] ,
557+ expr : Some ( call) ,
558+ hir_id,
559+ rules : hir:: BlockCheckMode :: UnsafeBlock ( hir:: UnsafeSource :: CompilerGenerated ) ,
560+ span : macsp,
561+ targeted_by_break : false ,
562+ } ) ,
563+ None ,
564+ )
567565 } else {
568566 // Generate:
569567 // <core::fmt::Arguments>::new_v1(
0 commit comments