"""Check every Rust source file, including include! fragments.""" import subprocess from pathlib import Path root = Path(__file__).resolve().parents[1] files = sorted(p for folder in ("src", "tests") for p in (root / folder).rglob("*.rs")) subprocess.run(["cargo", "fmt", "--all", "--check"], cwd=root, check=True) subprocess.run(["rustfmt", "--check", "--edition", "2024", *map(str, files)], cwd=root, check=True)