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 can delete comments within an attribute #4115

Closed
ahl opened this issue Apr 12, 2020 · 3 comments · Fixed by #4136
Closed

rustfmt can delete comments within an attribute #4115

ahl opened this issue Apr 12, 2020 · 3 comments · Fixed by #4136
Labels
a-comments bug Panic, non-idempotency, invalid code, etc.

Comments

@ahl
Copy link
Contributor

ahl commented Apr 12, 2020

source:

#[derive(A,
    B,
    C,
    D,
    // E,
)]
fn foo() {
    bar(1,
        2,
        3,
        4,
        // 5,
    );
}

post-rustfmt:

#[derive(A, B, C, D)]
fn foo() {
    bar(
        1, 2, 3, 4,
        // 5,
    );
}

I would expect something like:

#[derive(
    A, B, C, D,
    // E,
)]
fn foo() {
    bar(
        1, 2, 3, 4,
        // 5,
    );
}

I'd be happy to submit a PR for this.

@topecongiro topecongiro added the bug Panic, non-idempotency, invalid code, etc. label Apr 14, 2020
@calebcartwright
Copy link
Member

I'd be happy to submit a PR for this.

Awesome, thank you! Don't feel obligated to look into this by any means, but there's another issue with derives where they get dropped when malformed (#4029/#3898), and the respective fixes would likely touch a lot of the same code.

ahl added a commit to ahl/rustfmt that referenced this issue Apr 22, 2020
@ahl
Copy link
Contributor Author

ahl commented Apr 22, 2020

@calebcartwright ok, I fixed all three.

topecongiro added a commit that referenced this issue Apr 22, 2020
@calebcartwright
Copy link
Member

Awesome! Thank you so much @ahl 🎉

calebcartwright pushed a commit to calebcartwright/rustfmt that referenced this issue Nov 29, 2020
calebcartwright pushed a commit that referenced this issue Nov 29, 2020
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.

3 participants