You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lint enum_variant_names fires because RecvError, SendError and BindError variants are named like the type. That's the fundamental point of the lint, but it fails to consider information that'd be available to the linter: That that substring is also part of the encapsulated type.
I'm not well enough familiar with clippy to come up with code, but I'd like to suggest the following addition to the lint's rules:
If the variant contains a single item, and any component of the contained item's path is identical to the variant's name, then the lint does not trigger.
By including the full path, it would even protect a hypothetical enum Cbor { MiniCbor(minicbor::Something), SerdeCbor(serde_cbor::Something) }; I can't tell how much going-out-of-the-way it would need to catch SerdeCbor to be justified by serde_cbor, so maybe a simpler version that just doesn't trigger on the real example above suffices.
The text was updated successfully, but these errors were encountered:
Clippy is unhappy with this perfectly reasonable enum:
The lint
enum_variant_names
fires becauseRecvError
,SendError
andBindError
variants are named like the type. That's the fundamental point of the lint, but it fails to consider information that'd be available to the linter: That that substring is also part of the encapsulated type.I'm not well enough familiar with clippy to come up with code, but I'd like to suggest the following addition to the lint's rules:
By including the full path, it would even protect a hypothetical
enum Cbor { MiniCbor(minicbor::Something), SerdeCbor(serde_cbor::Something) }
; I can't tell how much going-out-of-the-way it would need to catchSerdeCbor
to be justified byserde_cbor
, so maybe a simpler version that just doesn't trigger on the real example above suffices.The text was updated successfully, but these errors were encountered: