Format pass + pre-commit hook to run cargo fmt #2
Loading…
Reference in a new issue
No description provided.
Delete branch "git-hook-cargo-fmt"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a one-time cargo fmt pass and a versioned pre-commit hook that keeps the workspace rustfmt-clean.
Format pass
cargo fmtacross thelexercrate (4 files, pure formatting, no behaviour change; the 8-test suite still passes,cargo fmt --checknow clean).Pre-commit hook
.githooks/pre-commit(mode 755, versioned in-repo so every clone can share it): runscargo fmt --checkand blocks the commit if any Rust is unformatted. It does not auto-stage; the author runscargo fmt, stages withgit add, then commits, keeping the index exactly what they intended.~/.cargo/envfirst (cargo is only on the PATH after activation on this box)..rsfiles are staged.git config core.hooksPath .githooks(documented in AGENTS.md).Verified end-to-end: the hook aborts (exit 1) on a staged unformatted file with a clear message, and passes on a clean tree.