style: format the whole repo with rustfmt - #123
Merged
Merged
Conversation
`main` carried 159 rustfmt diffs across 28 files, so nobody could run `cargo fmt --all` without burying their change in unrelated churn — a 58-line fix expanded to 918 lines when I tried it during #115. Every PR since has had to hand-check that it introduced no new violations. No rustfmt.toml, so this is stock defaults on rustfmt 1.9.0 (edition 2021). Formatting only. Verified mechanically rather than by inspection: across all 28 files the token multiset is identical to `main` once `{`, `}` and `,` are excluded. What changed is whitespace, line wrapping, block-to-expression match arms, trailing commas, and `use`-statement ordering. cargo test --workspace 380 passed, 0 failed cargo clippy --all-targets clean cargo fmt --all --check clean promql corpus docs 48/49, testdata 1512/1823 — unchanged Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-shot
cargo fmt --all. Formatting only — no semantic change.Why now
maincarried 159 rustfmt diffs across 28 files. That meant nobody could runcargo fmt --allwithout burying their change in unrelated churn — when I tried it while working on #115, a 58-line fix expanded to 918 lines and I had to reset and redo the edits by hand. Every PR since (#116, #117, #119, #121, #122) has had to hand-check, file by file, that it introduced no new violations.Clearing the baseline once makes
cargo fmtusable again.No
rustfmt.toml, so this is stock defaults onrustfmt 1.9.0(edition 2021).How I verified it is formatting-only
Not by reading 694 lines of diff. Mechanically: for each of the 28 files, tokenize both versions and compare the token multiset, excluding
{,}and,(the three tokens rustfmt is allowed to add or remove).So the only changes are whitespace, line wrapping, block-to-expression match arms (
=> { expr }→=> expr), trailing commas, anduse-statement ordering.An earlier, cruder check — "strip all whitespace and compare" — flagged 26 files. That check was wrong, not the diff: it cannot tolerate rustfmt reordering imports or inserting trailing commas. Worth stating because the first result looked alarming.
Verification
PromQL corpus unchanged:
docs 48/49,testdata 1512/1823.Follow-up worth considering
This repo has no test CI (only a "Check PR title" check), so nothing stops the baseline from drifting again. A
cargo fmt --all --checkjob would keep it at zero — and, separately, acargo test --workspacejob would have caught themain-does-not-compile breakage that #113 fixed, where two individually-green PRs conflicted semantically once both landed.🤖 Generated with Claude Code