Open
Description
This example does not warn, even in Rust 2018 edition:
// compile-flags: --edition 2018
extern crate foo;
fn main() { foo::bar(); }
The reason is that we resolve foo
against the extern crate, when in fact it could also be resolved by the extern prelude fallback. But that's tricky! Something like this could also happen:
// compile-flags: --edition 2018
mod bar { mod foo { } }
use bar::*; // `foo` here is shadowed by `foo` below
extern crate foo;
fn main() { foo::bar(); }
In which case, removing foo
would result in importing the module, since (I believe) that would shadow the implicit prelude imports.
Therefore: we can do better here, but with caution -- for example, we could suggest removing an extern crate in a scenario like this, but only if there are no glob imports in the current module. Not sure it's worth it though.