-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Bad suggestion for dependency_on_unit_never_type_fallback for wildcard assignment expression #133688
Copy link
Copy link
Closed
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-editionDiagnostics: An error or lint that should account for edition differences.Diagnostics: An error or lint that should account for edition differences.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-editionDiagnostics: An error or lint that should account for edition differences.Diagnostics: An error or lint that should account for edition differences.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.L-dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackLint: dependency_on_unit_never_type_fallbackT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The
dependency_on_unit_never_type_fallbacklint seems to provide a bad suggestion for an assignment to a wildcard pattern. Example (sorry, not minimized further, this is based on serde):This gives a suggestion to modify it with:
This is not valid syntax, as an assignment expression does not allow qualifying with types.
In this case, I'm uncertain if the fallback can actually be a problem? If not, then maybe the lint shouldn't fire? Or if a type annotation is needed, then maybe use fully-qualified syntax?
cc @WaffleLapkin