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

#[rustfmt::skip::attributes(derive)] not work. #5270

Closed
rise0chen opened this issue Mar 18, 2022 · 1 comment · Fixed by #5271
Closed

#[rustfmt::skip::attributes(derive)] not work. #5270

rise0chen opened this issue Mar 18, 2022 · 1 comment · Fixed by #5271
Labels
a-rustfmt::skip bug Panic, non-idempotency, invalid code, etc.

Comments

@rise0chen
Copy link

rise0chen commented Mar 18, 2022

    #[rustfmt::skip::attributes(derive)]
    #[allow(dead_code)]
    #[derive(StructField)]
    #[derive(Clone)]
    struct Struct {
        field: String,
    }

It will merge #derive(StructField) and #[derive(Clone)] to #derive(StructField, Clone)], when i run cargo fmt.

I don't want to merge #derive(StructField) and #[derive(Clone)].

@ytmimi ytmimi added the bug Panic, non-idempotency, invalid code, etc. label Mar 18, 2022
@ytmimi
Copy link
Contributor

ytmimi commented Mar 18, 2022

Thanks for the report!

Looks like the #[rustfmt::skip::attributes(derive)] isn't being honored when merge_derives=true is set (which is the default). You might also consider setting merge_derives=false if you need a short term fix. Check out the config docs for merge_derives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-rustfmt::skip bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants