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

# Allows "fix" or "--fix"
FLAG=""
for arg in "$@"; do
	case "$arg" in
		fix|--fix)
			FLAG="--allow-dirty --allow-staged --fix"
			;;
	esac
done

cargo fmt --all
cargo clippy --all --workspace --all-features --all-targets $FLAG
