@@ -760,9 +760,9 @@ impl<'a, 'b> Context<'a, 'b> {
760760 /// Actually builds the expression which the format_args! block will be
761761 /// expanded to.
762762 fn into_expr ( self ) -> P < ast:: Expr > {
763- let mut locals =
764- Vec :: with_capacity ( ( 0 .. self . args . len ( ) ) . map ( |i| self . arg_unique_types [ i ] . len ( ) ) . sum ( ) ) ;
765- let mut counts = Vec :: with_capacity ( self . count_args . len ( ) ) ;
763+ let mut args = Vec :: with_capacity (
764+ self . arg_unique_types . iter ( ) . map ( |v| v . len ( ) ) . sum :: < usize > ( ) + self . count_args . len ( ) ,
765+ ) ;
766766 let mut heads = Vec :: with_capacity ( self . args . len ( ) ) ;
767767
768768 // First, build up the static array which will become our precompiled
@@ -783,7 +783,7 @@ impl<'a, 'b> Context<'a, 'b> {
783783 // passed to this function.
784784 for ( i, e) in self . args . into_iter ( ) . enumerate ( ) {
785785 for arg_ty in self . arg_unique_types [ i] . iter ( ) {
786- locals . push ( Context :: format_arg ( self . ecx , self . macsp , e. span , arg_ty, i) ) ;
786+ args . push ( Context :: format_arg ( self . ecx , self . macsp , e. span , arg_ty, i) ) ;
787787 }
788788 heads. push ( self . ecx . expr_addr_of ( e. span , e) ) ;
789789 }
@@ -793,13 +793,10 @@ impl<'a, 'b> Context<'a, 'b> {
793793 _ => panic ! ( "should never happen" ) ,
794794 } ;
795795 let span = spans_pos[ index] ;
796- counts . push ( Context :: format_arg ( self . ecx , self . macsp , span, & Count , index) ) ;
796+ args . push ( Context :: format_arg ( self . ecx , self . macsp , span, & Count , index) ) ;
797797 }
798798
799- // Now create a vector containing all the arguments
800- let args = locals. into_iter ( ) . chain ( counts. into_iter ( ) ) ;
801-
802- let args_array = self . ecx . expr_vec ( self . macsp , args. collect ( ) ) ;
799+ let args_array = self . ecx . expr_vec ( self . macsp , args) ;
803800
804801 // Constructs an AST equivalent to:
805802 //
0 commit comments