Skip to content

Removing braces from format string #2538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nrc opened this issue Mar 17, 2018 · 1 comment
Closed

Removing braces from format string #2538

nrc opened this issue Mar 17, 2018 · 1 comment
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@nrc
Copy link
Member

nrc commented Mar 17, 2018

My repro is nested inside a macro, but I'm not sure if that is important:

             macro_rules! add_message_to_notes {
-                ($msg:expr) => {{
+                ($msg: expr) => {{
                     let mut lines = message.lines();
                     notes.push_str(&format!("\n{}: {}", level, lines.next().unwrap()));
                     for line in lines {
                         notes.push_str(&format!(
-                            "\n{:indent$}{line}",
+                            "\n{:indent$line}",
                             "",
                             indent = level.len() + 2,
                             line = line,
                         ));
                     }
-                }}
+                }};
             }

The error is removing }{ from "\n{:indent$}{line}"

@nrc nrc added the bug Panic, non-idempotency, invalid code, etc. label Mar 17, 2018
@nrc nrc added this to the 1.0 milestone Mar 17, 2018
@topecongiro
Copy link
Contributor

I doubt that replace_names is doing somthing wrong, so I think being inside a macro is relevant.

topecongiro added a commit to topecongiro/rustfmt that referenced this issue Mar 17, 2018
@nrc nrc closed this as completed in #2541 Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

No branches or pull requests

2 participants