The tree does not format under the installed rustfmt, so every change carries churn it did not make #118

Closed
opened 2026-08-13 23:31:35 +02:00 by Claude · 3 comments
Collaborator

rustfmt 1.9.0-stable (8bab26f4f6, 2026-07-14) reformats 58 places on main at a3cbc04, in files nothing recent has touched:

crates/jellyfin-app/src/tasks.rs, crates/jellyfin-app/tests/scan_enriched.rs,
crates/jellyfin-app/tests/scan_images.rs, crates/jellyfin-core/src/localization.rs,
crates/jellyfin-db/tests/by_name_values.rs, crates/jellyfin-db/tests/parental_rating.rs,
crates/jellyfin-http/src/routes/images.rs, crates/jellyfin-http/src/routes/system.rs,
crates/jellyfin-http/tests/common/mod.rs, crates/jellyfin-server/src/main.rs,
xtask/src/reference/enriched.rs

cargo fmt --check therefore fails on a clean checkout, which costs something specific: anyone who runs cargo fmt while making an unrelated change commits a diff that is mostly somebody else`'s lines. It was hit for real while implementing #112 — the churn had to be reverted by hand to keep the commit honest.

The tree was formatted by an older rustfmt and the toolchain has moved. Two ways out:

  • Reformat once, in a commit that is nothing but the reformat, so the noise is in one place with a message that says so.
  • Pin the formatter — a rust-toolchain.toml, or the rustfmt.toml options that make 1.9 agree with what is committed — if the current formatting is deliberate.

Either is fine; drifting is not, because it makes every future diff dirtier than it is.

How to know it is done

cargo fmt --check exits zero on a clean checkout with the toolchain the project expects, and it stays that way — which probably means saying somewhere which toolchain that is.

rustfmt 1.9.0-stable (8bab26f4f6, 2026-07-14) reformats **58 places** on `main` at `a3cbc04`, in files nothing recent has touched: ``` crates/jellyfin-app/src/tasks.rs, crates/jellyfin-app/tests/scan_enriched.rs, crates/jellyfin-app/tests/scan_images.rs, crates/jellyfin-core/src/localization.rs, crates/jellyfin-db/tests/by_name_values.rs, crates/jellyfin-db/tests/parental_rating.rs, crates/jellyfin-http/src/routes/images.rs, crates/jellyfin-http/src/routes/system.rs, crates/jellyfin-http/tests/common/mod.rs, crates/jellyfin-server/src/main.rs, xtask/src/reference/enriched.rs ``` `cargo fmt --check` therefore fails on a clean checkout, which costs something specific: anyone who runs `cargo fmt` while making an unrelated change commits a diff that is mostly somebody else`'s lines. It was hit for real while implementing #112 — the churn had to be reverted by hand to keep the commit honest. The tree was formatted by an older rustfmt and the toolchain has moved. Two ways out: - **Reformat once**, in a commit that is nothing but the reformat, so the noise is in one place with a message that says so. - **Pin the formatter** — a `rust-toolchain.toml`, or the `rustfmt.toml` options that make 1.9 agree with what is committed — if the current formatting is deliberate. Either is fine; drifting is not, because it makes every future diff dirtier than it is. ## How to know it is done `cargo fmt --check` exits zero on a clean checkout with the toolchain the project expects, and it stays that way — which probably means saying somewhere which toolchain that is.
Author
Collaborator

The eleven paths in the evidence block above are left as they were on purpose: they
record what reformatted at a3cbc04, and rewriting them to where those files live today
would turn a measurement into a claim about a tree that was never measured. Four of them
have since moved or been split — crates/jellyfin-app/src/tasks.rs is now
admin/tasks.rs, routes/images.rs is now library/images/, routes/system.rs is now
admin/system.rs, and crates/jellyfin-core/src/localization.rs is where it was.

Two things about the current state, neither of which closes this:

  • cargo fmt --all --check exits zero on main today (rustfmt 1.9.0-stable
    8bab26f4f6, the same build this issue names). The 58 places were absorbed by the fmt
    runs that rode along with the cleanup commits since a3cbc04 — which is precisely the
    failure mode described here, just spread across other people's commits instead of one
    honest reformat.
  • The toolchain is still unpinned: there is no rust-toolchain.toml and no
    rustfmt.toml. So the first half of "how to know it is done" holds by accident and the
    second half — and it stays that way — does not hold at all. The next rustfmt release
    reopens this exactly as before.

What is left of this issue is therefore the pin, not the reformat.

The eleven paths in the evidence block above are **left as they were on purpose**: they record what reformatted at `a3cbc04`, and rewriting them to where those files live today would turn a measurement into a claim about a tree that was never measured. Four of them have since moved or been split — `crates/jellyfin-app/src/tasks.rs` is now `admin/tasks.rs`, `routes/images.rs` is now `library/images/`, `routes/system.rs` is now `admin/system.rs`, and `crates/jellyfin-core/src/localization.rs` is where it was. Two things about the current state, neither of which closes this: - **`cargo fmt --all --check` exits zero on `main` today** (rustfmt 1.9.0-stable `8bab26f4f6`, the same build this issue names). The 58 places were absorbed by the fmt runs that rode along with the cleanup commits since `a3cbc04` — which is precisely the failure mode described here, just spread across other people's commits instead of one honest reformat. - **The toolchain is still unpinned**: there is no `rust-toolchain.toml` and no `rustfmt.toml`. So the first half of "how to know it is done" holds by accident and the second half — *and it stays that way* — does not hold at all. The next rustfmt release reopens this exactly as before. What is left of this issue is therefore the pin, not the reformat.
Author
Collaborator

Ran cargo fmt --all on main at 1f89431: no diff. cargo fmt --all --check exits
zero under rustfmt 1.9.0-stable (8bab26f4f6), the build this issue measured, so there is
no reformat left to commit — the 58 places were absorbed by the fmt runs that rode along
with the cleanup commits after a3cbc04.

Closing on the first half of "how to know it is done". The second half is not met and is
not fixed by formatting: there is still no rust-toolchain.toml and no rustfmt.toml, so
nothing says which formatter the tree is formatted by, and the next rustfmt release
reopens this the same way. That is a one-file change and belongs in its own issue rather
than keeping this one open.

Ran `cargo fmt --all` on `main` at `1f89431`: **no diff**. `cargo fmt --all --check` exits zero under rustfmt 1.9.0-stable (`8bab26f4f6`), the build this issue measured, so there is no reformat left to commit — the 58 places were absorbed by the fmt runs that rode along with the cleanup commits after `a3cbc04`. Closing on the first half of "how to know it is done". The second half is not met and is not fixed by formatting: there is still no `rust-toolchain.toml` and no `rustfmt.toml`, so nothing says which formatter the tree is formatted by, and the next rustfmt release reopens this the same way. That is a one-file change and belongs in its own issue rather than keeping this one open.
Author
Collaborator

The other half is done too, so this is now closed on both halves rather than one.

87c0560 adds rust-toolchain.toml pinning 1.97.1 — the version the tree already
formats clean under (rustfmt 1.9.0-stable, 8bab26f4f6) — with rustfmt and clippy
as components so a fresh checkout has both. rustup reads it on its own, so
cargo fmt and cargo clippy now run under a named version rather than whatever
stable happens to be that week, and the README's build section says so for a human.

Verified under the pin: cargo fmt --all --check exits zero, cargo clippy --workspace --all-targets is silent, cargo nextest run --workspace is 2256/2256.

Moving the pin is deliberately its own commit, with whatever reformat it causes — which
is the "one honest reformat" this issue asked for, applied to every future toolchain bump
instead of just this one.

The other half is done too, so this is now closed on both halves rather than one. `87c0560` adds `rust-toolchain.toml` pinning **1.97.1** — the version the tree already formats clean under (`rustfmt 1.9.0-stable`, `8bab26f4f6`) — with `rustfmt` and `clippy` as components so a fresh checkout has both. `rustup` reads it on its own, so `cargo fmt` and `cargo clippy` now run under a named version rather than whatever `stable` happens to be that week, and the README's build section says so for a human. Verified under the pin: `cargo fmt --all --check` exits zero, `cargo clippy --workspace --all-targets` is silent, `cargo nextest run --workspace` is 2256/2256. Moving the pin is deliberately its own commit, with whatever reformat it causes — which is the "one honest reformat" this issue asked for, applied to every future toolchain bump instead of just this one.
Sign in to join this conversation.
No description provided.