-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
cargo clippy --fix
seems to imply --tests
which is at least undocumented
#10690
Comments
@rustbot claim |
OutdatedAfter some debugging, turns out this bug is Cargo's fault. You don't need to open an issue to Cargo, I'll do it myself with some more information.I say this just so you know this will take a while, as Cargo's debugging + PR process is lengthier. Turns out this isn't Cargo's fault, they document that behaviour. It's our fault. |
@blyxyas Hehe, nice positive wording "so it can fix as much as it can". But I'd rather be a bit more honest and mention the technical cause because it's still at least a bit surprising that |
Are you saying that I'm dishonest? |
@blyxyas No, I didn't mean to discredit you, of course. But as I see it the behavior is basically an implementation detail (just as you've described in your last comment) and not a feature. In fact, it's actually a bit astonishing and inconsistent that It's ok to accept that and document it. Or there are two other possibilities.
But that's not my judgement call to make. :-) |
Summary
After reading the rust 1.69 release notes, I wanted to give
cargo clippy --fix
a try and thereby found out that whilecargo clippy
had nothing to complain about in my sample project,cargo clippy --fix
issued several warnings (which couldn't be fixed automatically). Turns out, all warnings were in#[test]
functions. And indeed,cargo clippy --tests
issued the same warnings.So it seems like
--fix
implies--tests
. Not a big deal but at least not quite expected and especially not documented, AFAICT.Reproducer
I tried this code:
I expected the first two clippy invocations but not the third:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: