init_numbered_fields incorrectly triggers for type alias of tuple struct #8638
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Summary
The clippy lint
init_numbered_fields
introduced in 1.59.0 is emitted with an incorrect suggested fix when the struct initialization is for a type alias to a tuple or unit struct.This case should be omitted from the lint entirely, as there is no means other than use of numbered fields to initialize a tuple struct for which only the type alias can be reliably known, because the type alias cannot be used as a constructor.
Lint Name
init_numbered_fields
Reproducer
I tried this code:
I ran
cargo clippy
I saw this happen:
I expected to see this happen:
because "A type alias to a tuple-struct or unit-struct cannot be used to qualify that type's constructor:", this should not trigger when the tuple struct initialization is being invoked through a type alias.
Version
Additional Labels
@rustbot label +I-suggestion-causes-error
The text was updated successfully, but these errors were encountered: