Uh oh!
There was an error while loading. Please reload this page.
Improve unused extern crate and unused #[macro_use] warnings - #39060
Conversation
47c8ba5 to
4a90ee4CompareThere was a problem hiding this comment.
And all these unused crates will still live undetected in Cargo.tomls and introduce build dependencies :(rustc needs to somehow communicate this information to cargo so it could warn too.
cc @alexcrichton
There was a problem hiding this comment.
It's true yeah that it needs to be propagated outwards, but this may not need rustc -> cargo support. The compiler could simply warn about unused --extern flags, and we could perhaps tailor it so the warning makes sense if you're just using Cargo.
In any case that seems like future work to me.
alexcrichton
commented
Jan 14, 2017
I've been wary of doing this in the past because linking a crate can have side effects other than wanting to pull in items/macros. For example you might link an allocator or just link a crate which contains a native library. I'd personally still prefer that the lint were allow by default. |
2ae2155 to
3186708Comparejseyfried
commented
Jan 15, 2017
@alexcrichton |
4785cf4 to
ec51ba3Comparealexcrichton
commented
Jan 15, 2017
@jseyfried I haven't though too closely about how we might solve that problem, although it would likely involve taking a look at the crates that just that one crate pulls in (e.g. not shared dependencies from other crates) and then seeing what items it pulls in (e.g. any native libs, allocators, etc.) |
67dc901 to
2b1d677Comparejseyfried
commented
Jan 16, 2017
@alexcrichton Ok, seems feasible but not easy -- I might try later in another PR. |
@alexcrichton, @jseyfried |
@alexcrichton is reported by the |
alexcrichton
commented
Jan 16, 2017
I'm merely stating my opinion that I would like to not have this lint turned on by default. I personally feel very strongly that if a lint has a false positive it should be allow-by-default, but that's mostly just me. |
KalitaAlexey
commented
Jan 16, 2017
@petrochenkov, |
jseyfried
commented
Jan 16, 2017
@petrochenkov There were 31 "true positives" and 1 "false positive" in rustc bootstrap. |
nrc
commented
Jan 18, 2017
@bors: r+ |
bors
commented
Jan 18, 2017
📌 Commit 2b1d677 has been approved by |
Rollup of 28 pull requests - Successful merges: #38603, #38761, #38842, #38847, #38955, #38966, #39062, #39068, #39077, #39111, #39112, #39114, #39118, #39120, #39132, #39135, #39138, #39142, #39143, #39146, #39157, #39166, #39167, #39168, #39179, #39184, #39195, #39197 - Failed merges: #39060, #39145
bors
commented
Jan 21, 2017
☔ The latest upstream changes (presumably #39199) made this pull request unmergeable. Please resolve the merge conflicts. |
2b1d677 to
7753f19Comparejseyfried
commented
Jan 21, 2017
@alexcrichton Thanks! |
bors
commented
Jan 21, 2017
📌 Commit 7753f19 has been approved by |
bors
commented
Jan 21, 2017
⌛ Testing commit 7753f19 with merge f117e15... |
bors
commented
Jan 21, 2017
💔 Test failed - status-travis |
alexcrichton
left a comment
There was a problem hiding this comment.
Btw if you want to annotate crates in tree to deny this lint by default I'd be down for that
There was a problem hiding this comment.
This, while unused, is intended to be linked for the side effects.
There was a problem hiding this comment.
Fixed -- thanks again :)
60240aa to
9e9262bComparebors
commented
Jan 21, 2017
📌 Commit 9e9262b has been approved by |
bors
commented
Jan 22, 2017
⌛ Testing commit 9e9262b with merge 7a8c8af... |
bors
commented
Jan 22, 2017
💔 Test failed - status-travis |
9e9262b to
191abc4Comparejseyfried
commented
Jan 22, 2017
@bors r=nrc |
bors
commented
Jan 22, 2017
📌 Commit 191abc4 has been approved by |
bors
commented
Jan 22, 2017
Improve unused `extern crate` and unused `#[macro_use]` warnings This PR - adds `unused_imports` warnings for unused `#[macro_use] extern crate` macro imports, - improves `unused_extern_crates` warnings (avoids false negatives), and - removes unused `#[macro_use]` imports and unused `extern crate`s. r? @nrc
bors
commented
Jan 22, 2017
☀️ Test successful - status-appveyor, status-travis |
This PR
unused_importswarnings for unused#[macro_use] extern cratemacro imports,unused_extern_crateswarnings (avoids false negatives), and#[macro_use]imports and unusedextern crates.r? @nrc