2021-06-10 23:05:51 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-06-15 22:04:50 +00:00
|
|
|
# hide output
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Update lints
|
|
|
|
cargo dev update_lints
|
|
|
|
git add clippy_lints/src/lib.rs
|
2021-09-18 04:57:03 +00:00
|
|
|
git add clippy_lints/src/lib.*.rs
|
2021-06-15 22:04:50 +00:00
|
|
|
|
|
|
|
# Formatting:
|
|
|
|
# Git will not automatically add the formatted code to the staged changes once
|
|
|
|
# fmt was executed. This collects all staged files rs files that are currently staged.
|
|
|
|
# They will later be added back.
|
|
|
|
#
|
|
|
|
# This was proudly stolen and adjusted from here:
|
|
|
|
# https://medium.com/@harshitbangar/automatic-code-formatting-with-git-66c3c5c26798
|
|
|
|
files=$( (git diff --cached --name-only --diff-filter=ACMR | grep -Ei "\.rs$") || true)
|
|
|
|
if [ ! -z "${files}" ]; then
|
|
|
|
cargo dev fmt
|
|
|
|
git add $(echo "$files" | paste -s -d " " -)
|
|
|
|
fi
|