Closed
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 :))