Uh oh!
There was an error while loading. Please reload this page.
merge unused-extern-crate and unnecessary-extern-crate lints - #51015
Conversation
rust-highfive
commented
May 24, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
alexcrichton
commented
May 24, 2018
Seems like a fine idea to me! I haven't personally looked too closely at this lint yet for removing |
bors
commented
May 25, 2018
☔ The latest upstream changes (presumably #50879) made this pull request unmergeable. Please resolve the merge conflicts. |
3ee1606 to
8eedba0Comparenikomatsakis
commented
May 25, 2018
ok I added the |
8eedba0 to
295046dComparerust-highfive
commented
May 25, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
295046d to
f2ddd1dComparerust-highfive
commented
May 26, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
alexcrichton
commented
May 27, 2018
r=me when this is passing travis! |
3583475 to
85bf5b0Comparerust-highfive
commented
May 28, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
85bf5b0 to
da0e605Compareda0e605 to
b0d6b75Comparenikomatsakis
commented
May 28, 2018
This is gonna break clippy cc @Manishearth and @oli-obk — but pretty trivial change. |
nikomatsakis
commented
May 28, 2018
@bors r=acrichto |
bors
commented
May 28, 2018
📌 Commit b0d6b75 has been approved by |
bors
commented
May 28, 2018
🔒 Merge conflict |
bors
commented
May 28, 2018
☔ The latest upstream changes (presumably #50929) made this pull request unmergeable. Please resolve the merge conflicts. |
b0d6b75 to
d3b30b1Comparenikomatsakis
commented
May 29, 2018
@bors r=alexcrichton |
bors
commented
May 29, 2018
📌 Commit d3b30b1 has been approved by |
andjo403
commented
May 29, 2018
@nikomatsakis shall this lint also work with unused extern crates from the --extern flag to rustc? |
nikomatsakis
commented
May 29, 2018
@andjo403 that would be a nice extension; it doesn't now though. Ideally, we'd have some way to point into the |
bors
commented
May 29, 2018
💔 Test failed - status-travis |
rust-highfive
commented
May 29, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
1 similar comment
rust-highfive
commented
May 29, 2018
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
kennytm
commented
May 30, 2018
bors
commented
May 30, 2018
🔒 Merge conflict |
We first collect unused crates into a map and then walk all extern crates in crate order.
7b7901b to
b37cc85Comparekennytm
commented
Jun 2, 2018
@bors r=alexcrichton |
bors
commented
Jun 2, 2018
📌 Commit b37cc85 has been approved by |
bors
commented
Jun 2, 2018
…diom, r=alexcrichton merge unused-extern-crate and unnecessary-extern-crate lints Extend the `unused_extern_crates` lint to offer a suggestion to remove the extern crate and remove the `unnecessary_extern_crate` lint. Still a few minor issues to fix: - [x] this *does* now leave a blank line... (defer to #51176) - idea: extend the span to be replaced by 1 character if the next character is a `\n` - [x] what about macros? do we need to watch out for that? (defer to #48704) - [x] also it doesn't work for `extern crate foo; fn main() { foo::bar(); }` - this is subtle: the `foo` might be shadowing a glob import too, can't always remove - defer to #51177 - [x] we also don't do the `pub use` rewrite thang (#51013) Spun off from #51010Fixes#50672 r? @alexcrichton
bors
commented
Jun 2, 2018
☀️ Test successful - status-appveyor, status-travis |
SimonSapin
commented
Jun 6, 2018
Does |
| fn main() {} | ||
| fn main() { | ||
| unsafe { a::getpid(); } | ||
| unsafe { b::getpid(); } |
There was a problem hiding this comment.
What are these calls testing? As per #49219 (comment), these don't exist on wasm32, is there a suitable replacement for libc?
Or should I just ignore the test on wasm32 (ideally I wouldn't).
There was a problem hiding this comment.
I suspect that they make a, b, etc used, so they report "extern crate is not idiomatic" rather than "extern crate is unused".
AFAIK, libc has universally available names like c_int or c_void, so they can be used instead.
typeA = a::c_int;// Makes `a` usedThere was a problem hiding this comment.
No, wasm32 has an empty libc last I checked. Maybe we can flip alloc and libc, as I expect alloc to not be empty on wasm32?
There was a problem hiding this comment.
alloc would do too.
Or a new custom crate in the auxiliary dir.
Extend the
unused_extern_crateslint to offer a suggestion to remove the extern crate and remove theunnecessary_extern_cratelint.Still a few minor issues to fix:
\nextern crate foo; fn main() { foo::bar(); }foomight be shadowing a glob import too, can't always removepub userewrite thang (unused_extern_crateslint does not suggest rewriting crates to auseorpub use#51013)Spun off from #51010
Fixes#50672
r? @alexcrichton