Skip to content

Commit dc84255

Browse files
committed
Document how to use rust-toolchain.toml to avoid breaking changes in CI
I've had Clippy suddenly start to fail in GitHub Actions for me in multiple ways. If Clippy was still a crate, I'd just pin it as a dependency and run https://crates.io/crates/cargo-run-bin/1.7.2 However, that's unfortunately not possible and I found it far from obvious what to do instead. My understanding is that pinning it using `rust-toolchain.toml` like this is the "correct" way to avoid breaking changes in CI. This took me some time and research (and personal help from a Rust expert) to figure out and I'd like to save others the trouble by documenting it.
1 parent 40bead0 commit dc84255

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

book/src/installation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ If Clippy was not installed for a toolchain, it can be installed with
1515
$ rustup component add clippy [--toolchain=<name>]
1616
```
1717

18+
### Use a specific version of Clippy
19+
20+
Clippy may introduce new warnings and errors between associated Rust versions.
21+
This may be desirable if you want to learn about newly detectable issues in your
22+
codebase over time, but it can cause [continuous integration](./continuous_integration/index.md)
23+
to fail even if you haven't touched your Rust code. If you'd like to keep Clippy's
24+
behaviour stable for your project, use
25+
[`rust-toolchain.toml`](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file)
26+
to pin your entire Rust toolchain. For example:
27+
28+
```toml
29+
[toolchain]
30+
channel = "1.83.0"
31+
components = ["clippy"]
32+
```
33+
1834
## From Source
1935

2036
Take a look at the [Basics] chapter in the Clippy developer guide to find step-by-step

0 commit comments

Comments
 (0)