@@ -760,9 +760,9 @@ impl<'a, 'b> Context<'a, 'b> {
760
760
/// Actually builds the expression which the format_args! block will be
761
761
/// expanded to.
762
762
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
+ ) ;
766
766
let mut heads = Vec :: with_capacity ( self . args . len ( ) ) ;
767
767
768
768
// First, build up the static array which will become our precompiled
@@ -783,7 +783,7 @@ impl<'a, 'b> Context<'a, 'b> {
783
783
// passed to this function.
784
784
for ( i, e) in self . args . into_iter ( ) . enumerate ( ) {
785
785
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) ) ;
787
787
}
788
788
heads. push ( self . ecx . expr_addr_of ( e. span , e) ) ;
789
789
}
@@ -793,13 +793,10 @@ impl<'a, 'b> Context<'a, 'b> {
793
793
_ => panic ! ( "should never happen" ) ,
794
794
} ;
795
795
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) ) ;
797
797
}
798
798
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) ;
803
800
804
801
// Constructs an AST equivalent to:
805
802
//
0 commit comments