Skip to content

rustfmt deletes comment at start of array length expression #6434

Open
@ctz

Description

@ctz

I write this code:

struct Abc([u8;
// five
5 +
// ten
10 +
// thirteen
13
]);

rustfmt formats this to:

struct Abc(
    [u8; 5 +
// ten
10 +
// thirteen
13],
);

It has lost the // five comment. The remainder of the formatting is not great.

playground

version:

rustfmt 1.8.0-stable (90b35a6239 2024-11-26)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a-commentsbugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions