#!/usr/bin/env bash
set -euo pipefail

repo_root="$(git rev-parse --show-toplevel)"
cd "$repo_root"

if ! command -v cargo >/dev/null 2>&1; then
    echo "cargo is required to run the Rust formatting check." >&2
    exit 1
fi

echo "Running cargo fmt --all --check"
cargo fmt --all --check
