Is it possible to run cargo clippy
with an option so it will fix warnings automatically?
From the help message, it does not look like this option is supported at the moment.
The Clippy tool is a collection of lints to analyze your code so you can catch common mistakes and improve your Rust code.
cargo fix
can already apply some suggestions deriving from rustc
's errors and warnings.
In nightly builds you can use cargo clippy --fix
to apply some suggestions from Clippy. In some older Rust versions, the syntax is reversed: cargo fix --clippy
.
If you are using a stable version of the Rust toolchain, you can opt-in to use a nightly build for just one command, by using +nightly
to override the toolchain:
cargo +nightly clippy --fix -Z unstable-options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With