@@ -233,7 +233,6 @@ pub struct Formatter<'a> {
233
233
precision : Option < usize > ,
234
234
235
235
buf : & ' a mut ( dyn Write + ' a ) ,
236
- args : & ' a [ ArgumentV1 < ' a > ] ,
237
236
}
238
237
239
238
// NB. Argument is essentially an optimized partially applied formatting function,
@@ -1041,7 +1040,6 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
1041
1040
buf : output,
1042
1041
align : rt:: v1:: Alignment :: Unknown ,
1043
1042
fill : ' ' ,
1044
- args : args. args ,
1045
1043
} ;
1046
1044
1047
1045
let mut idx = 0 ;
@@ -1060,7 +1058,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
1060
1058
// a string piece.
1061
1059
for ( arg, piece) in fmt. iter ( ) . zip ( args. pieces . iter ( ) ) {
1062
1060
formatter. buf . write_str ( * piece) ?;
1063
- run ( & mut formatter, arg) ?;
1061
+ run ( & mut formatter, arg, & args . args ) ?;
1064
1062
idx += 1 ;
1065
1063
}
1066
1064
}
@@ -1074,25 +1072,24 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
1074
1072
Ok ( ( ) )
1075
1073
}
1076
1074
1077
- fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: v1:: Argument ) -> Result {
1078
- // Fill in the format parameters into the formatter
1075
+ fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: v1:: Argument , args : & [ ArgumentV1 < ' _ > ] ) -> Result {
1079
1076
fmt. fill = arg. format . fill ;
1080
1077
fmt. align = arg. format . align ;
1081
1078
fmt. flags = arg. format . flags ;
1082
- fmt. width = getcount ( & fmt . args , & arg. format . width ) ;
1083
- fmt. precision = getcount ( & fmt . args , & arg. format . precision ) ;
1079
+ fmt. width = getcount ( args, & arg. format . width ) ;
1080
+ fmt. precision = getcount ( args, & arg. format . precision ) ;
1084
1081
1085
1082
// Extract the correct argument
1086
1083
let value = {
1087
1084
#[ cfg( bootstrap) ]
1088
1085
{
1089
1086
match arg. position {
1090
- rt:: v1:: Position :: At ( i) => fmt . args [ i] ,
1087
+ rt:: v1:: Position :: At ( i) => args[ i] ,
1091
1088
}
1092
1089
}
1093
1090
#[ cfg( not( bootstrap) ) ]
1094
1091
{
1095
- fmt . args [ arg. position ]
1092
+ args[ arg. position ]
1096
1093
}
1097
1094
} ;
1098
1095
@@ -1145,10 +1142,6 @@ impl<'a> Formatter<'a> {
1145
1142
align : self . align ,
1146
1143
width : self . width ,
1147
1144
precision : self . precision ,
1148
-
1149
- // These only exist in the struct for the `run` method,
1150
- // which won’t be used together with this method.
1151
- args : self . args ,
1152
1145
}
1153
1146
}
1154
1147
0 commit comments