Skip to content
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

Poor formatting of macro_rules rhs with consecutive top-level blocks #2740

Open
dtolnay opened this issue May 26, 2018 · 3 comments
Open

Poor formatting of macro_rules rhs with consecutive top-level blocks #2740

dtolnay opened this issue May 26, 2018 · 3 comments

Comments

@dtolnay
Copy link
Member

dtolnay commented May 26, 2018

Rustfmt turns this input:

macro_rules! repro {
    () => {
        {
            let _guard = ();
        }
        {
            let _guard = ();
        }
    };
}

into this output:

macro_rules! repro {
    () => {{
        let _guard = ();
    }
    {
        let _guard = ();
    }};
}

I believe the original is clearer.

@dtolnay
Copy link
Member Author

dtolnay commented May 26, 2018

@RReverser
Copy link
Contributor

RReverser commented Jul 30, 2018

Sorry I missed this! I agree this should be fixed, has_block_body heuristic is far from perfect for this case.

@ytmimi
Copy link
Contributor

ytmimi commented Jul 20, 2022

Macro bodies are left unchanged when format_macro_bodies=false

linking tracking issue for format_macro_bodies #3355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants