Skip to content

Commit d09c418

Browse files
committed
Touch up PR 286
1 parent 097251d commit d09c418

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

impl/src/attr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn parse_error_attribute<'a>(attrs: &mut Attrs<'a>, attr: &'a Attribute) -> Resu
104104
return Ok(());
105105
}
106106

107-
let fmt = input.parse()?;
107+
let fmt: LitStr = input.parse()?;
108108
let args = parse_token_expr(input, false)?;
109109
let display = Display {
110110
original: attr,
@@ -202,9 +202,9 @@ impl ToTokens for Display<'_> {
202202
let fmt = &self.fmt;
203203
let args = &self.args;
204204

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.
208208
tokens.extend(if self.use_write_str {
209209
quote! {
210210
__formatter.write_str(#fmt)

0 commit comments

Comments
 (0)