#!/bin/sh
# Pre-commit hook for cargo projects

# Run cargo fmt
cargo fmt --all -- --check || {
    echo "Formatting check failed. Run 'cargo fmt --all' to fix."
    exit 1
}

# Run cargo clippy
cargo clippy --all-targets --all-features -- -D warnings || {
    echo "Clippy check failed. Please fix the warnings."
    exit 1
}

# Run tests
cargo test || {
    echo "Tests failed. Please fix the failing tests."
    exit 1
}
