File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1026,28 +1026,30 @@ pub fn write(output: &mut dyn Write, args: Arguments) -> Result {
10261026 curarg : args. args . iter ( ) ,
10271027 } ;
10281028
1029- let mut pieces = args . pieces . iter ( ) ;
1029+ let mut idx = 0 ;
10301030
10311031 match args. fmt {
10321032 None => {
10331033 // We can use default formatting parameters for all arguments.
1034- for ( arg, piece) in args. args . iter ( ) . zip ( pieces. by_ref ( ) ) {
1034+ for ( arg, piece) in args. args . iter ( ) . zip ( args . pieces . iter ( ) ) {
10351035 formatter. buf . write_str ( * piece) ?;
10361036 ( arg. formatter ) ( arg. value , & mut formatter) ?;
1037+ idx += 1 ;
10371038 }
10381039 }
10391040 Some ( fmt) => {
10401041 // Every spec has a corresponding argument that is preceded by
10411042 // a string piece.
1042- for ( arg, piece) in fmt. iter ( ) . zip ( pieces. by_ref ( ) ) {
1043+ for ( arg, piece) in fmt. iter ( ) . zip ( args . pieces . iter ( ) ) {
10431044 formatter. buf . write_str ( * piece) ?;
10441045 formatter. run ( arg) ?;
1046+ idx += 1 ;
10451047 }
10461048 }
10471049 }
10481050
10491051 // There can be only one trailing string piece left.
1050- if let Some ( piece) = pieces. next ( ) {
1052+ if let Some ( piece) = args . pieces . get ( idx ) {
10511053 formatter. buf . write_str ( * piece) ?;
10521054 }
10531055
You can’t perform that action at this time.
0 commit comments