#!/bin/sh
# Pre-commit hook (installed by cargo-husky). Mirrors the CI lint gate so format
# and clippy issues are caught before they leave the machine.
set -e

echo "▶ cargo fmt --all -- --check"
cargo fmt --all -- --check || {
    echo "✗ Formatting check failed — run 'cargo fmt --all' to fix." >&2
    exit 1
}

echo "▶ cargo clippy --all-targets --all-features -- -D warnings"
cargo clippy --all-targets --all-features -- -D warnings || {
    echo "✗ Clippy found warnings — please fix them before committing." >&2
    exit 1
}

echo "✓ fmt + clippy clean"
