-
Notifications
You must be signed in to change notification settings - Fork 1.6k
clippy -D warnings doesn't fail on warnings #5749
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
For context, this is example code that correctly fails on warning,
And running with: |
Copying my reply of another issue (#5733 (comment)):
Regarding your issue: In the above post you wrote, that you used |
Appreciate the syntax note. I originally started to browse lints and apply many, but it seemed easier to disable lints than to try and pick large amounts of them. I currently have ~7 or so disabled, some at the source of warnings where it makes sense.
Good catch, thank you. I have edited it to correctness. For context I actually use
Because I need to work around this problem while needing my CI to actually fail when it should, I've resorted to some (poorly written) bash:
(Note, the above bash may fail in undesired circumstances, it is incomplete. I'm only just adding it now, we'll see if it works with some editing /shrug) In very limited tests so far, this properly fails when clippy does not. So, at least it can probably be worked around with some external scripting. |
Can you try to use |
Same deal:
(the above is highly edited to remove code, project names, etc. Trying to keep my employer happy lol. Sorry for the silliness.)
edit: no luck, neither removing the other workspace members or setting up my example reproduction as a workspace caused a change in either repositories behavior. |
Uh I don't think this is a Clippy issue then, but a cargo issue, where the lint levels doesn't get passed through the workspace members. This may be related to rust-lang/cargo#5015, where the same problem with features existed. @ehuss do you know if @leeola Can you try if the same thing happens with |
Hm, that's a tricky issue.
Some things I would check:
|
Interesting. I'm not exactly sure what to look for, but it looks like there may be a problem here. In my test repo, the one where
Which I imagine is what you're referencing. However, I cannot get this to display in my bugged repo. In my bugged repo, passing
Not a single Good call, this seems a strong suspect for the root cause.
I'll try manually running it by using the test crate as a reference, but since I cannot actually see the Thanks for the help all! |
Oh, and:
Same deal (ran with cargo clean, but I'm not including all the compilation lines here):
|
@leeola Sorry for the late reply, I stayed away from OSS for a bit. What I suspect from the fact, that the same happens with What I think might be the problem is, that you have a
|
I've been able to reliably reproduce Once I've ever run clippy without src/main.c
My testing:
In this example, clippy with |
This should've been fixed in #6834 and already landed in nightly. @bmc-msft Which version of Clippy are you using? ( (This will hit beta next week and stable in 1.52) |
I was testing with latest stable I can confirm 0.1.52 fixes the issue. Thanks! |
I have a internal project (cannot share, unfortunately) with a series of lints defined in the
lib.rs
,main.rs
, etc. Eg:I am attempting to get CI to fail when linting this project, via:
cargo clippy -Z unstable-options -- --deny "warnings"
. However, clippy is printing warnings and not exiting.Having recently struggled with Clippy and Caching (ala #4612) I even resorted to
cargo clean && cargo clippy -Z unstable-options -- --deny "warnings"
, however clippy still prints warnings without failing.Unfortunately I cannot seem to reproduce this issue in another crate; something I could post here as a reproduction. The same Rust & Clippy version in another crate, with the same
#[warn(clippy::restriction)]
, is correctly failing on-D warnings
, where as my private crate is incorrectly not failing. My CI pipeline is currently running-D warnings
while printing warnings and not failing. This issue is not isolated to just my PC.I'm seeking some advice here on how to debug this, and provide a reproducible bug report. Any thoughts are appreciated, thank you.
Meta
The text was updated successfully, but these errors were encountered: