Skip to content

field: Type /* Comment */ , /* Comment */ causes rustfmt to introduce breaking comma #5425

@hlbarber

Description

@hlbarber

While strange,

struct Struct {
    field: String /* Comment */ , /* Comment */
}

compiles.

When hit with cargo fmt it's transformed into

struct Struct {
    field: String, /* Comment */ , /* Comment */
}

which fails to compile.

Observed on rustfmt 1.5.1-nightly (2022-06-30 7425fb2) and rustfmt 1.4.38-stable (db9d1b2 2022-01-20).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEP-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions