Skip to content

Commit 40a35cd

Browse files
authored
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 some time and research (and help from @obi1kenobi) to figure out and I'd like to save others the trouble by documenting it.
1 parent 40bead0 commit 40a35cd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

book/src/installation.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ 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. This may be desirable if you want to learn about newly detectable issues in your codebase over time, but it can cause [continuous integration](./continuous_integration/index.md) to fail even if you haven't touched your Rust code. If you'd like to keep Clippy's behaviour stable for your project, use [`rust-toolchain.toml`](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) to pin your entire Rust toolchain. For example:
21+
22+
```toml
23+
[toolchain]
24+
channel = "1.83.0"
25+
components = ["clippy"]
26+
```
27+
1828
## From Source
1929

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

0 commit comments

Comments
 (0)