Skip to content

Nightly formatter removes multi line comments in extern blocks #4532

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

Closed
faern opened this issue Nov 17, 2020 · 3 comments
Closed

Nightly formatter removes multi line comments in extern blocks #4532

faern opened this issue Nov 17, 2020 · 3 comments
Labels
bug Panic, non-idempotency, invalid code, etc. duplicate

Comments

@faern
Copy link

faern commented Nov 17, 2020

Describe the bug

If I have A multi line comment in an extern block preceding a function declaration, it is removed. But not a single line comment.

To Reproduce

If I have this code:

extern "C" {
    // A comment that is
    // spread out over
    // multiple lines
    fn a();

    // A single line comment
    fn b();
}

And format it with the nightly formatter. I end up with:

extern "C" {
    fn a();

    // A single line comment
    fn b();
}

Expected behavior

I expect both comments to be retained. As far as I know it's not invalid or unidiomatic to write a comment multi line comment on an extern declaration.

Meta

  • rustfmt version: rustfmt 1.4.26-nightly (293d7d0 2020-11-14)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: cargo +nighty fmt
@faern faern added the bug Panic, non-idempotency, invalid code, etc. label Nov 17, 2020
@calebcartwright
Copy link
Member

Duplicate of #4528

@calebcartwright calebcartwright marked this as a duplicate of #4528 Nov 17, 2020
@faern
Copy link
Author

faern commented Nov 17, 2020

Sorry, did not find that one when trying to look for a duplicate. Great it's being worked on already 👍

@calebcartwright
Copy link
Member

No worries!

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

No branches or pull requests

2 participants