-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Lint unused extern crate #17134
Lint unused extern crate #17134
Conversation
We may want to consider moving this lint to allow-by-default, as linkage is normally much trickier and nuanced than things like imports. In terms of rust-semantics, an unused crate should probably be deleted, but in terms of an unused library I don't think a lint can actually cover that (only the linker can). Also, can you add a test for this as well? You'll fine some similar tests for lints in |
@alexcrichton is this test okay ? |
That looks great, thanks! One last thing you may want to consider is adding this to the Other than that this looks good to me, thanks! |
@alexcrichton Okay, done. I also rebased and squashed the commits. |
@alexcrichton Oops, I had left some too long lines, I corrected that. |
…richton This PR creates a new lint : ``unused_extern_crate``, which do pretty much the same thing as ``unused_import``, but for ``extern crate`` statements. It is related to feature request #10385. I adapted the code tracking used imports so that it tracks extern crates usage as well. This was mainly trial and error and while I believe all cases are covered, there might be some code I added that is useless (long compile times didn't give me the opportunity to check this in detail). Also, I removed some unused ``extern crate`` statements from the libs, that where spotted by this new lint.
internal: Don't render unknown lifetimes when rendering generic args cc rust-lang/rust-analyzer#17098
internal: Don't render unknown lifetimes when rendering generic args cc rust-lang/rust-analyzer#17098
This PR creates a new lint :
unused_extern_crate
, which do pretty much the same thing asunused_import
, but forextern crate
statements. It is related to feature request #10385.I adapted the code tracking used imports so that it tracks extern crates usage as well. This was mainly trial and error and while I believe all cases are covered, there might be some code I added that is useless (long compile times didn't give me the opportunity to check this in detail).
Also, I removed some unused
extern crate
statements from the libs, that where spotted by this new lint.