Skip to content

ci: check formatting on one toolchain, not the whole matrix - #34

Merged
pigri merged 1 commit into
mainfrom
ci/pin-fmt-toolchain
Sep 27, 2026
Merged

pigri merged 1 commit into
mainfrom
ci/pin-fmt-toolchain

Conversation

@pigri

@pigri pigri commented Sep 27, 2026

Copy link
Copy Markdown

cargo fmt --all -- --check runs for every entry in the build matrix,
including unpinned nightly.

rustfmt's output drifts between nightlies, so an unrelated rustfmt change can
turn every open PR red with no commit to this repo. That happened between
nightly 2026-08-14 and 2026-09-23, when rustfmt started requiring a block
comment's closing delimiter to align with the lines above it: main went red
on its own, and PRs inherited a failure that had nothing to do with them.
Patching the comment unblocked it, but the next drift does the same thing.

Change

One line — the fmt step is gated to the pinned stable toolchain:

- name: Run cargo fmt
  if: matrix.toolchain == '1.97.1'
  run: cargo fmt --all -- --check

This follows the file's own convention: clippy, audit and machete are already
restricted to 1.97.1. The nightly and MSRV jobs keep building and testing
exactly as before — only the formatting check stops being run three times
against three different rustfmt versions.

Trade-off worth knowing

Bumping the pinned stable in the matrix now means updating this guard too, or
the check silently stops running. The three steps below it already have that
property, so this does not add a new class of problem, but it is a second
place to remember.

Verification

cargo +1.97.1 fmt --all -- --check passes on this branch, and the workflow
parses. CI is the real test: the nightly job should no longer run a fmt step
and should still build and test.

`cargo fmt --all -- --check` ran for every entry in the matrix, including
unpinned `nightly`. rustfmt's output drifts between nightlies, so an
unrelated rustfmt change could turn every open PR red with no commit to this
repo — which is what happened when a nightly started requiring a block
comment's closing delimiter to align with the lines above it. `main` went red
on its own, and PRs inherited a failure that had nothing to do with them.

Formatting is now checked once, against the toolchain the project pins. That
matches how clippy, audit and machete are already restricted to 1.97.1 in
this file; the `nightly` and MSRV jobs keep building and testing as before.

Note the coupling this creates: bumping the pinned stable in the matrix means
updating this guard too, or the check silently stops running. The three steps
below have the same property.
@pigri
pigri merged commit edbd2cd into main Sep 27, 2026
4 checks passed
@pigri
pigri deleted the ci/pin-fmt-toolchain branch September 27, 2026 12:45
@linear-code

linear-code Bot commented Sep 27, 2026

Copy link
Copy Markdown

SYN-311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant