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

Lines changed: 4 additions & 4 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy