File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ fn parse_error_attribute<'a>(attrs: &mut Attrs<'a>, attr: &'a Attribute) -> Resu
104
104
return Ok ( ( ) ) ;
105
105
}
106
106
107
- let fmt = input. parse ( ) ?;
107
+ let fmt: LitStr = input. parse ( ) ?;
108
108
let args = parse_token_expr ( input, false ) ?;
109
109
let display = Display {
110
110
original : attr,
@@ -202,9 +202,9 @@ impl ToTokens for Display<'_> {
202
202
let fmt = & self . fmt ;
203
203
let args = & self . args ;
204
204
205
- // Currently compiler is unable to generate as efficient code for
206
- // write!(f, "text") as it does for f.write_str("text"),
207
- // so handle it here when the literal string has no braces/no args .
205
+ // Currently `write!(f, "text")` produces less efficient code than
206
+ // `f.write_str( "text")`. We recognize the case when the format string
207
+ // has no braces and no interpolated values, and generate simpler code .
208
208
tokens. extend ( if self . use_write_str {
209
209
quote ! {
210
210
__formatter. write_str( #fmt)
You can’t perform that action at this time.
0 commit comments