Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

T02 Add rustfmt.toml and clippy.toml

Question

Cerebro has neither config. Add:

  • rustfmt.toml with the import and comment knobs that require a nightly rustfmt (imports_granularity = "Module", group_imports = "StdExternalCrate", wrap_comments = true, comment_width = 100, max_width = 100, edition 2024). Then one-time cargo fmt as its own mechanical PR (no other edits) so later lint-fix PRs don’t collide with the reflow.
  • clippy.toml with the four test exceptions: allow-expect-in-tests, allow-unwrap-in-tests, allow-panic-in-tests, allow-indexing-slicing-in-tests (the standard permits the panic classes in tests; ADR 6).

Exit predicate

cargo fmt --check green with the new config; clippy.toml present; the fmt diff is a standalone commit on its worktree branch.

Resolution

Done 2026-10-31 on the pinned nightly (T01).

  • clippy.toml: the four test exceptions (allow-expect-in-tests, allow-unwrap-in-tests, allow-panic-in-tests, allow-indexing-slicing-in-tests). Inert until T09 denies the panic classes in production; lands as its own commit.
  • rustfmt.toml: imports_granularity = "Module", group_imports = "StdExternalCrate", wrap_comments, comment_width = 100, max_width = 100, edition 2024, field-init and try shorthands.
  • One-time cargo fmt --all: 50 files, +252/−163, dominated by import regrouping; committed separately from the config so the reflow diff stays mechanically reviewable. The map’s closed-findings row for T02 is deferred to a later bookkeeping edit on purpose: #88 edits the map right now and this PR avoids the collision by touching only this ticket file.

Gate evidence: cargo fmt --all -- --check clean; just quality fully green under the new configs (clippy --all-targets -D warnings, workspace tests, release-script suite 70/70, vale 0/0).