-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.
Description
Given the following code: Playground link
pub struct Example();
mod test {
use super::Example;
#[test]
fn test_f() {
Example();
}
}
The current output is:
warning: unused import: `super::Example`
--> src/lib.rs:4:9
|
4 | use super::Example;
| ^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
However, the import is actually required for the test. It would be helpful if the compiler suggested adding #[cfg(test)]
to mod test
to fix the issue. (Thanks to pie_flavor on Discord for pointing out that that's the issue :))
Walther, atsuzaki, TaKO8Ki, Kobzol and tux3
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.