Skip to content

Double Space between pub & when preceeded by long attribute #4671

@jonasbb

Description

@jonasbb

Describe the bug

Formatting this code places two spaces between pub and &.

struct X<'a>(
    #[X(X = "_________________________________________________________________________")]
    pub  &'a u32,
    // ^^
);

Expected behavior

The usual formatting is pub &'a u32 (single space). I would expect rustfmt to stay consistent. Removing the attribute, shortening it, or turning it into a comment all lead to the single space formatting.

Meta

  • rustfmt 1.4.25-stable (0f29ff6 2020-11-11)
  • rustfmt 1.4.30-nightly (acd9486 2020-12-20)
  • rustfmt 1.4.32-nightly (2021-01-16 216a643) (playground)
  • From where did you install rustfmt? rustup, playground
  • How do you run rustfmt: cargo fmt, playground, VSCode

Metadata

Metadata

Assignees

No one assigned

    Labels

    1x-backport:pendingFixed/resolved in source but not yet backported to a 1x branch and releasepoor-formatting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions