anvilsign in

collin/anvil

1#!/bin/sh
2# Pre-commit: rustfmt (nightly, for the unstable options in rustfmt.toml),
3# cargo-sort-derives, and clippy.
4# Wired up via `git config core.hooksPath .githooks`.
5set -e
6
7if ! cargo +nightly fmt --all -- --check >/dev/null 2>&1; then
8 cargo +nightly fmt --all
9 echo "pre-commit: rustfmt reformatted files — review, re-stage, and commit again." >&2
10 git diff --name-only -- '*.rs' >&2
11 exit 1
12fi
13
14if ! cargo sort-derives --check >/dev/null 2>&1; then
15 cargo sort-derives
16 echo "pre-commit: cargo sort-derives reordered derives — review, re-stage, and commit again." >&2
17 git diff --name-only -- '*.rs' >&2
18 exit 1
19fi
20
21cargo clippy --workspace --all-targets -- -D warnings