Skip to content

Comments on items in extern block are deleted #4533

Closed
@Aaron1011

Description

@Aaron1011

Describe the bug

When a normal comment (non-doc-comment) is applied to an item in an extern block, rustfmt will delete it.

To Reproduce

The following code:

extern "C" {
    // A comment
    fn bar();
}

is formatted as:

extern "C" {
    fn bar();
}

Expected behavior

rustfmt should leave the comment intact

Meta

  • rustfmt version: rustfmt 1.4.26-nightly (293d7d0 2020-11-14)
  • From where did you install rustfmt?: rustup
  • How do you run rustfmt: rustfmt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions