Compiler emits invalid help diagnostic when unused import is found in test module #96611
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given a
#[cfg(test)]
-annotated module that contains an unused import, like so: (Rust Playground)The compiler outputs a warning and corresponding help message like this:
Obviously the
help
is erroneous because the annotation it's recommending is already there. I assume the logic determining whether to add the help message naively assumes that "unused import warning" + "test module" + "reference to unused import's value inside of test module" = "help message", in which case it should be revised to consider whether the test module's reference is unused as well.The text was updated successfully, but these errors were encountered: