File tree 1 file changed +6
-4
lines changed
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 {
1026
1026
curarg : args. args . iter ( ) ,
1027
1027
} ;
1028
1028
1029
- let mut pieces = args . pieces . iter ( ) ;
1029
+ let mut idx = 0 ;
1030
1030
1031
1031
match args. fmt {
1032
1032
None => {
1033
1033
// 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 ( ) ) {
1035
1035
formatter. buf . write_str ( * piece) ?;
1036
1036
( arg. formatter ) ( arg. value , & mut formatter) ?;
1037
+ idx += 1 ;
1037
1038
}
1038
1039
}
1039
1040
Some ( fmt) => {
1040
1041
// Every spec has a corresponding argument that is preceded by
1041
1042
// 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 ( ) ) {
1043
1044
formatter. buf . write_str ( * piece) ?;
1044
1045
formatter. run ( arg) ?;
1046
+ idx += 1 ;
1045
1047
}
1046
1048
}
1047
1049
}
1048
1050
1049
1051
// 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 ) {
1051
1053
formatter. buf . write_str ( * piece) ?;
1052
1054
}
1053
1055
You can’t perform that action at this time.
0 commit comments