unused import warning should have identifier in first line #37376
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Currently, the
unused_imports
lint 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_variables
anddead_code
lints both include the name of the function or variable in the first line of the warning.The text was updated successfully, but these errors were encountered: