-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Potential false positive for wildcard_imports #5917
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
Comments
Hi, I'd like to give this a go and try to submit a PR for this. As far as I can see https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/wildcard_imports.rs#L200 only allows wildcard where the last segment before the wildcard is "prelude", so I assume we would hereby allow wildcards where |
Hi, and welcome to Clippy! Yes, I think that makes sense 👍 |
Prelude imports are exempt from wildcard import warnings. Until now only imports of the form ``` use ...::prelude::*; ``` were considered. This change makes it so that the segment `prelude` can show up anywhere, for instance: ``` use ...::prelude::v1::*; ``` Fixes rust-lang#5917
Prelude imports are exempt from wildcard import warnings. Until now only imports of the form ``` use ...::prelude::*; ``` were considered. This change makes it so that the segment `prelude` can show up anywhere, for instance: ``` use ...::prelude::v1::*; ``` Fixes rust-lang#5917
Widen understanding of prelude import Prelude imports are exempt from wildcard import warnings. Until now only imports of the form ``` use ...::prelude::*; ``` were considered. This change makes it so that the segment `prelude` can show up anywhere, for instance: ``` use ...::prelude::v1::*; ``` Fixes #5917 changelog: Allow `prelude` to appear in any segment of the import path in [`wildcard_imports`]
Widen understanding of prelude import Prelude imports are exempt from wildcard import warnings. Until now only imports of the form ``` use ...::prelude::*; ``` were considered. This change makes it so that the segment `prelude` can show up anywhere, for instance: ``` use ...::prelude::v1::*; ``` Fixes #5917 changelog: Allow `prelude` to appear in any segment of the import path in [`wildcard_imports`]
Prelude imports are exempt from wildcard import warnings. Until now only imports of the form ``` use ...::prelude::*; ``` were considered. This change makes it so that the segment `prelude` can show up anywhere, for instance: ``` use ...::prelude::v1::*; ``` Fixes rust-lang#5917
I tried this code:
I expected to see this happen: explanation
No warning, since this is a prelude import which is exempt from the
wildcard_imports
rule. I think it's the versioning suffix::v1
from theno-std-compat
crate that throws it off.Instead, this happened: explanation
Meta
cargo clippy -V
: clippy 0.0.212 (7e6d6e5 2020-08-16)rustc -Vv
:Backtrace
The text was updated successfully, but these errors were encountered: