-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Clippy doesn't report error/warnings after cargo check #4612
Comments
The only reasonable way to fix it is #3837 With nightly toolchain you can use |
@mati865 for now I will use |
It works better if you
|
I think we should document this ( |
@flip1995 where would you document it? In a new separate Troubleshooting section or as a comment/tips to the step-3-run-clippy |
I think at step-3-run-clippy is enough, since it will be removed anyway in the near future. |
This issue can also be triggered by running clippy multiple times with different options. fn main() {
let _1 = 1_usize;
println!("{}", _1);
}
|
It looks like this is now fixed?
shows the right errors every time I run it.
|
That would surprise me, because we didn't change anything. I just tested #4612 (comment) and the behavior didn't change there. |
Clippy still depends on check: |
What about having |
You can just make a script that will call |
@mati865 don't you think that this is not a solution? |
@humb1t neither modifying files without permission is the solution. |
This is now fixed when running Clippy with cargo clippy -Zunstable-options on nightly. |
@mati865 totally agree with you |
The feature should be available as soon as nightly 2020-04-18 rolls out. |
If I run the following commands (in this order) in my workspace, which has some # dead_code errors
cargo clippy -Z unstable-options -- -D warnings
# dead_code + clippy::restriction errors
cargo clippy -Z unstable-options -- -D warnings -D clippy::restriction
# dead_code errors
cargo clippy -Z unstable-options -- -D warnings However, if I use warnings instead of errors, the first invocation's output is cached. # dead_code warnings
cargo clippy -Z unstable-options
# dead_code warnings
cargo clippy -Z unstable-options -- -W clippy::restriction
find -name "*.rs" -exec touch {} \;
# dead_code + clippy::restriction warnings
cargo clippy -Z unstable-options -- -W clippy::restriction
# dead_code + clippy::restriction warnings
cargo clippy -Z unstable-options Not sure if I'm using an outdated Clippy version, none of the comments seem to specify which is the "fixed" nightly, or even link to the relevant pull request. rustc 1.44.0-nightly (b2e36e6c2 2020-04-22)
clippy 0.0.212 (891e1a8 2020-04-18) |
You should be using the nightly where this is already included. @yaahc any ideas? |
Here's a shorter reproduction case echo "fn unused() {}" > src/lib.rs
cargo clippy -Z unstable-options
cargo clippy -Z unstable-options -- --allow dead_code
touch src/lib.rs
cargo clippy -Z unstable-options -- --allow dead_code
cargo clippy -Z unstable-options Note that it works fine with errors, but not warnings. echo "pub fn bad() -> bool { 0 <= 0 }" > src/lib.rs
cargo clippy -Z unstable-options
cargo clippy -Z unstable-options -- --allow clippy::eq_op
touch src/lib.rs
cargo clippy -Z unstable-options -- --warn clippy::all
cargo clippy -Z unstable-options -- --allow clippy::eq_op
|
This is probably an issue with cargo, I'll check it out tomorrow. cc @ehuss |
The caching with different flags is rust-lang/cargo#7862. The issue is twofold. One is that clippy hides the flags from cargo (via EDIT: I haven't looked into this, but I'm uncertain why clippy uses the flag hack. If it used |
We'll just run `cargo clean` first (until this gets resolved: rust-lang/rust-clippy/issues/4612).
This is now fixed in Clippy and will land in some nightly over the weekend. This means the fix will hit stable (if nothing goes wrong) in 1.52.0. |
Hi, I'm happy this issue fixed.
One issue for me is that clippy run slower than cargo-check command. There are some reasons why clippy is slower than cargo-check:
Should I opened an issue to track this on clippy side ? Those said, my personal issue should not be a reason to revert the fix. |
Yes this is true for your crate, not for the dependencies. This is because Clippy runs more lints and analyzes your code more than Clippy lints are not run for dependencies (except local path dependencies, but you can disable this behavior with
This change didn't even land yet. The effect of this change is solely that you don't have to |
Summary: Rust 1.52 is out! The [release notes] have the rundown, but I’m excited in particular for [`str::split_once`] and a [caching fix for Clippy]. [release notes]: https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html [`str::split_once`]: https://doc.rust-lang.org/std/primitive.str.html#method.split_once [caching fix for Clippy]: rust-lang/rust-clippy#4612 wchargin-branch: rust-v1.52.0 wchargin-source: b4be6db4e642e3c2bbf34d476556901cf12c0c60
Summary: Rust 1.52 is out! The [release notes] have the rundown, but I’m excited in particular for [`str::split_once`] and a [caching fix for Clippy]. [release notes]: https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html [`str::split_once`]: https://doc.rust-lang.org/std/primitive.str.html#method.split_once [caching fix for Clippy]: rust-lang/rust-clippy#4612 wchargin-branch: rust-v1.52.0
This issue is still pinned. Is this on purpose or just a leftover? I could understand it if you want people who aren't using the latest stable version to see this in the first place. But as said: is it on purpose? |
Since last Thursday it isn't on purpose anymore, since this hit stable 🎉 Thanks again |
This was being triggered by the derive for EnumSetType, which generates an item that triggers the lint. It wasn't seen until now due to [rust-lang/rust-clippy#4612][1], which was only fixed in Rust 1.52.0. [1]: rust-lang/rust-clippy#4612
This was being triggered by the derive for EnumSetType, which generates an item that triggers the lint. It wasn't seen until now due to [rust-lang/rust-clippy#4612][1], which was only fixed in Rust 1.52.0. [1]: rust-lang/rust-clippy#4612
Fix clippy Reference: rust-lang/rust-clippy#4612
This patch removes the `-Zunstable-options` from the default args for the clippy command. According to rust-lang/rust-clippy#4612, this work around is no longer needed. Fixes: kwrooijen#125 Signed-off-by: Curt Brune <[email protected]>
This patch removes the `-Zunstable-options` from the default args for the clippy command. According to rust-lang/rust-clippy#4612, this work around is no longer needed. Fixes: kwrooijen#125 Signed-off-by: Curt Brune <[email protected]>
Environment
Project: https://github.com/b1zzu/wifiscanner/tree/clippy-bug (use the
clippy-bug
branch`)Cargo: cargo 1.38.0 (23ef9a4ef 2019-08-20)
Clippy: clippy 0.0.212 (3aea860 2019-09-03)
Steps to reproduce
Run
cargo clippy
aftercargo check
Clippy doesn't fail or display any errors.
Expected result
cargo clippy
should fails with this errors:Workaround
The text was updated successfully, but these errors were encountered: