Skip to content

Commit b20593e

Browse files
committed
ci(lint): pin lint job to Rust 1.88.0 to fix rustfmt-not-installed error
The lint job used `dtolnay/rust-toolchain@stable` which installs rustfmt + clippy on the current stable (1.95). But `rust-toolchain.toml` pins cargo to 1.88.0, so when `cargo fmt --check` runs, it routes through the 1.88.0 toolchain that lacks rustfmt: error: 'cargo-fmt' is not installed for the toolchain '1.88.0-x86_64-unknown-linux-gnu' Switch the lint job to `dtolnay/rust-toolchain@1.88.0` so the installed components match the toolchain that actually runs cargo. The build/test jobs still use `@stable` since they only need rustc + cargo, both of which come with the default 1.88.0 install rustup auto-fetches when it sees `rust-toolchain.toml`.
1 parent c1f3aea commit b20593e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ jobs:
4848
steps:
4949
- uses: actions/checkout@v4
5050
- run: sudo apt-get update && sudo apt-get install -y perl
51-
- uses: dtolnay/rust-toolchain@stable
51+
# Install on the EXACT toolchain rust-toolchain.toml pins (1.88.0).
52+
# `@stable` would install rustfmt/clippy on the latest stable instead,
53+
# but `cargo` ends up calling the pinned 1.88.0 toolchain that lacks
54+
# those components, producing `'cargo-fmt' is not installed for the
55+
# toolchain '1.88.0-x86_64-unknown-linux-gnu'`.
56+
- uses: dtolnay/rust-toolchain@1.88.0
5257
with:
5358
components: rustfmt, clippy
5459
- uses: Swatinem/rust-cache@v2

0 commit comments

Comments
 (0)