-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
unused import warning should have identifier in first line #37376
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-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-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-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.
Currently, the
unused_importslint does not include the identifier that is unused in the first line of its warning output.Instead, it relies on the span system to highlight the identifier
For example, for the following code:
the produced warning is:
This means that the user who is reviewing the warnings needs to scan down four lines after the warning itself before they can see which identifier is being highlighted. In some contexts, the output may have even flowed off the visible portion of the console output.
Some other similar lints do not suffer from this problem because they include the offending identifier in the first line of the warning. For example, the
unused_variablesanddead_codelints both include the name of the function or variable in the first line of the warning.