Skip to content

Instantly share code, notes, and snippets.

View ariasuni's full-sized avatar

Aria ariasuni

View GitHub Profile
@zeenix
zeenix / rustfmt-git-hook
Created November 20, 2017 17:03
Git pre-commit hook to ensure your changes don't break rustfmt formatting rules
#!/bin/sh
for FILE in `git diff --cached --name-only`; do
if [[ $FILE == *.rs ]] && ! rustfmt --write-mode diff --skip-children $FILE; then
echo "Commit rejected due to invalid formatting of \"$FILE\" file."
exit 1
fi
done