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 attribute gets duplicated if preceded by a comment #3974

Closed
oli-obk opened this issue Dec 21, 2019 · 0 comments · Fixed by #3975
Closed

rustfmt::skip attribute gets duplicated if preceded by a comment #3974

oli-obk opened this issue Dec 21, 2019 · 0 comments · Fixed by #3975
Labels
a-comments bug Panic, non-idempotency, invalid code, etc.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Dec 21, 2019

fn emulate_foreign_item() {
    match link_name {
        // A comment here will duplicate the attribute
        #[rustfmt::skip]
        | "pthread_mutexattr_init"
        | "pthread_mutexattr_settype"
        | "pthread_mutex_init"
        => {}
    }
}

gets rustformatted to

fn emulate_foreign_item() {
    match link_name {
        // A comment here will duplicate the attribute
        #[rustfmt::skip]
        #[rustfmt::skip]
        | "pthread_mutexattr_init"
        | "pthread_mutexattr_settype"
        | "pthread_mutex_init"
        => {}
    }
}

if you continue rustfmting, the attributes get duplicated all the time, so you have exponential growth of attributes 😆

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

Successfully merging a pull request may close this issue.

2 participants