Closed
Description
use foo::Bar;
mod foo {
pub type Bar = i32;
}
fn baz() -> Bar { 3 }
fn main() {
use foo::Bar; // this should trigger an unused import warning
let _a: Bar = 3;
baz();
}
Right now that program has no unused import warnings, but the second one can be considered an unused import. The reason it's not unused is because it brings a name into the current scope, which is indeed then used. The catch is that the name it brings into scope is the exact same as what it was before.
It'd be nice if resolve caught this and basically didn't bring in any metadata about the inner use foo::Bar
import (only because it's already in scope by a previous import).
Not critical, but it would help us cut down on imports!