Skip to content

rustfmt deletes derived traits in #[derive(...)] #4584

Closed
@ente76

Description

@ente76

Describe the bug

Running cargo fmt on my project takes all #[derive(Debug, Clone, PartialEq, Eq)] and deletes exactly the last letter on each execution. It does not matter how many traits I derive. If I run it multiple times, it will stop at an empty derive().

To Reproduce

Setup a new library and add the following lines:

#[derive(Debug)]
pub enum Case {
    Upper,
    Lower
}

run cargo fmt

Expected behavior

cargo fmt finishes my project while I watch funny cat videos on youtube. At least rustfmt does not make my life harder than it is.

Meta

  • rustfmt version: rustfmt 1.4.29-nightly (70ce182 2020-12-04)
  • From where did you install rustfmt?: rustup nightly version: rustc 1.50.0-nightly (d32c320 2020-12-10)
  • How do you run rustfmt: cargo fmt (manually to test), usually via rust-analyzer during file saving

Metadata

Metadata

Labels

1x-backport:completedbugPanic, non-idempotency, invalid code, etc.only-with-optionrequires a non-default option value to reproduce

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions