You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I generally find glob imports to make the code unreadable and (I could be misremembering) caused quite a few problems in the codebase of rust-analyzer and rustc, I'm guessing because glob imports have different semantics to normal imports. So for example, the following code should compile:
mod foo {
pub struct Hello;
pub struct Bye;
}
mod bar {
use super::foo::*;
struct Hello {
a: u8,
}
fn baz() {
let h = Hello;
}
}
Note that we are using a glob import to import Hello from foo and then we are declaring a Hello in bar. Changing to let h = Hello{ a : 0} should also compile.
If you change use super::foo::*; to use super::foo::Hello; then the code will now not compile because you've imported two items under the Hello namespace
Problem
Current import system requires individual module or function imports, leading to lengthy and cluttered import sections.
Happy Case
Enable use module::*; syntax for importing all items from a module, simplifying code and reducing import lines.
Alternatives Considered
No response
Additional Context
No response
Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: