How to use rustup to install/use a specific history version of the component like: rustfmt, clippy?
My intention is that i would like to lint my code base always on a specific version of the components like rustfmt, clippy, then only upgrade the versions after i purposely did the evaluation, instead of randomly moving to the latest version.
When installed through rustup, the version of rustfmt, cargo, clippy and other components is tied to the version of Rust you are currently using, not the latest version.
For example, on my system I get different versions of clippy if I specify +stable (1.56.1) or +nightly (1.58.0-nightly):
$ cargo +stable clippy --version
clippy 0.1.56 (59eed8a 2021-11-01)
$ cargo +nightly clippy --version
clippy 0.1.58 (d914f17 2021-11-16)
When using rustup, you can pin your project to use a specific Rust version (as well as corresponding versions for other components) by using a rust-toolchain.toml file, like this:
[toolchain]
channel = "1.56.1"
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