-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add lint for prevent global import #1228
Comments
this should be a restriction lint. one hard optional feature would be to figure out what is currently used and add a suggestion to replace it with a full import list. |
Note that prelude modules such as use iron::prelude::*; may use a different lint ID, so one could allow glob-import of the preludes but warn against other glob imports. |
I do not know the syntax by memory, so I have to ask: is this still an issue after the module changes made for Rust 2018 Edition? |
Yep. Glob imports weren't changed. |
FWIW VS Code and Intellij IDEA both offer imports deglobbing which replace |
That's super awesome :D Is there a way to ask the compiler about the modules or symbols that the current file is using? If so, I think I know how to write this lint:
The |
Clippy already wans when importing all the variants of an enum. But this is still allowed:
This kind of global import makes the code more difficult to read since we don't know where symbols come from. It may also confuse IDEs. Could we add a lint to prevent this?
Link to the relevant reddit discussion
The text was updated successfully, but these errors were encountered: