claude-app/.claude/hooks/format-rs.sh

8 lines
235 B
Bash
Raw Normal View History

#!/bin/bash
# Auto-format Rust files after Edit/Write
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
if [[ "$FILE_PATH" == *.rs ]]; then
rustfmt --edition 2021 "$FILE_PATH" 2>/dev/null || true
fi