summaryrefslogtreecommitdiffstats
path: root/.githooks/pre-commit
blob: 432fc30e7be25ea5f78fc22daff2978bb46172bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#!/bin/sh

if git diff --cached --name-only --diff-filter=ACM | grep -q '\.rs$'; then
    if ! cargo fmt --all -- --check; then
        echo "Error: Unformatted Rust code detected. Run 'cargo fmt'." >&2
        exit 1
    fi
fi

exit 0