#!/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