rust-lang/rust-clippy

FR: redundant_field_names should distinguish between all and some fields matching

Open

#3 422 ouverte le 10 nov. 2018

Voir sur GitHub
 (1 commentaire) (4 réactions) (1 assigné)Rust (1 391 forks)batch import
C-enhancementL-stylegood first issue

Métriques du dépôt

Stars
 (10 406 stars)
Métriques de merge PR
 (Merge moyen 19j 22h) (113 PRs mergées en 30 j)

Description

redundant_field_names fires on any field being a match. This impairs readability in cases like this:

let thingy = Thingy {
   calc: big + calculation,
   redundant: redundant,
   other: stuff.into(),
};

As you can see, if you apply the suggestion, you end up with a weird line that is different from the rest. I suggest that the lint be split such that it distinguishes between "all fields are redundant" and "some fields are redundant".

Guide contributeur