-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Document how to use rust-toolchain.toml
to avoid breaking changes (e.g. in CI)
#14803
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
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
…n 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.
rust-toolchain.toml
to avoid breaking changes in CIrust-toolchain.toml
to avoid breaking changes (e.g. in CI)
This is not specific to Clippy: the compiler itself introduces new lints and warnings. For example, in Rust 1.88, transmuting between a |
I guess that's fair. In that case, if one looking for consistent code warnings then pinning like this is even more important? |
Yes, but does it belong to Clippy documentation when this is not Clippy specific? |
I would strongly argue yes. Absolutely.
The fact that the Rust compiler also performs some Clippy-like linting is something that people only know if they already familiar with the ecosystem. Everyone has to learn that for the first time, and I think the Clippy installation instructions are the perfect place to say "if you want consistent linting, here's what you need to know/do". If this information had been there when I first started using Clippy, I would have learned about the proper use of I've designed this PR to convey "if you're looking for consistent linting you'll probably actually want an entire pinned toolchain", but please let me know if I could change it to be more clear. I think it's reasonable to argue that someone can stitch the configuration together if you just give them links to other places, but at least in my case I would probably have missed the |
I've had Clippy suddenly start to fail in GitHub Actions for me in multiple ways over the last year.
If Clippy was still used as 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.Note that this issue talks about CI because that's that's a common forcing function for consistent linting, but it applies to local invocations as well.1 I think this is much better to document on the installation page instead of the CI pages specifically.
Footnotes
For example, I collaborate on a project where another team member regularly touches just the non-Rust code in the repo but runs all project tests locally before pushing. These local tests runs have failed for all sorts of ecosystem issues in the past, and that's never a good experience. So it's important for tools like Clippy to be stable even outside of CI, and I would personally want to know about how to do this when learning how to install Clippy for the first time. ↩