-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Cargo check - wrong warning about unused code (edition=2018, nightly 2018-12-7) #6430
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
I think this is expected. You can run |
Ah yes indeed, so closing! |
thanks @ehuss for the super-quick answer. Yes, that warning disappears adding that param, but I'm still slightly confused when it comes to integration tests (the real reason I submitted this issue). So, when I want to run And if yes, why do I need two params to have cargo check my integration tests code? Thanks for clarifying a bit more (still a newbie, sorry about that). |
For integration tests, The And no worries! Questions are welcome! |
@ehuss it was not easy! :) but I managed to create a small repo with the smallest test case possible: https://github.com/apiraino/cargo_issue_6430 I also think I understand exactly how to trigger the |
Ah, yea, I think that is expected to happen, since each test is essentially independent of one another. The |
Wow, the more I learn, the more I discover new things :-) That looked counter-intuitive to me, but I understand the rationale behind. Thank you for your time, really appreciated! 👍 |
ok, follow-up to this issue. I've moved all my tests into a separate crate. Now I'm building a monolithic library with all the integration tests. I've crated a separate project for this crate so I can copy and paste it as a starting point for my integration tests. |
Problem
cargo check
warns about unused code that is actually used.The desidered behaviour should be not to have these false positives.
Steps
cargo check
produces the warningwarning: method is never used: new
Possible Solution(s)
I suspect that is another manifestation of rust-lang/rust#54180. In case, feel free to clone in favor of that.
Notes
Output of
cargo version
:$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.10
Release: 18.10
Codename: cosmic
$ cargo version
cargo 1.32.0-nightly (5e85ba1 2018-12-02)
$ rustc --version
rustc 1.32.0-nightly (4a45578bc 2018-12-07)
Thanks for looking!
The text was updated successfully, but these errors were encountered: