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

Comments inside a function do not wrap whenever macro attributes are applied to the outside of the function #3965

Open
AaronKutch opened this issue Dec 13, 2019 · 2 comments
Labels
a-macros only-with-option requires a non-default option value to reproduce p-low poor-formatting

Comments

@AaronKutch
Copy link

AaronKutch commented Dec 13, 2019

in .rustfmt.toml:

comment_width = 80
error_on_line_overflow = true
error_on_unformatted = true
max_width = 100
wrap_comments = true

in main.rs:

macro_rules! impl_stuff {
    (
        $($attributes:meta),*;
    ) => {
        $(
            #[$attributes]
        )*
        pub fn y_u_no_format() {
            // Wrapping long comments by hand every time indentation changes is very annoying, and rustfmt normally helps with this,
            // but for some reason refuses when the `$(#[$attributes])*` is attached to the function.
        }
    }
}

fn main() {}

It makes no sense to me why this would affect formatting inside the function, the code compiles just fine.

@topecongiro topecongiro added a-macros only-with-option requires a non-default option value to reproduce poor-formatting labels Dec 15, 2019
@topecongiro
Copy link
Contributor

Repeat is not supported by rustfmt at the moment, sorry.

@ytmimi ytmimi added the p-low label Jul 21, 2022
@ytmimi
Copy link
Contributor

ytmimi commented Jul 21, 2022

Confirming I can reproduce this with rustfmt 1.5.1-nightly (f2c31ba0 2022-07-19)

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
Labels
a-macros only-with-option requires a non-default option value to reproduce p-low poor-formatting
Projects
None yet
Development

No branches or pull requests

3 participants