-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
unused_imports
false positive
#120422
Comments
It's only used in |
Yeah, cfgs are not (and cannot really be) factored into these lints. |
@ChrisDenton oh, good point, that's both true and still confusing. @Nilstrieb IIRC there was some work to be able to at least suggest things in lints based on inactive cfg, maybe the same could work here? |
There was (and I happened to do that work :3) but this is pretty unrelated and would require properly checking cfg-ed out code, which is exactly what we don't want to do and can't do. |
Maybe a different approach would work: when running |
All The recent extension of |
Code
Current output
Desired output
No warning.
Rationale and extra context
#[macro_use]
is actually used. When I removed it I get compilation failure. And while it can be argued, this is not the best style anduse alloc::format;
is better, the lint should say it if it's the case. (But really, I think this belongs to clippy, not rustc.)Other cases
No response
Rust Version
The text was updated successfully, but these errors were encountered: