rpm-ostree/ci/codestyle.sh
Colin Walters a2c5d1e659 Run rustfmt, and fix CI check for it
Moving the crate to the toplevel broke the CI check for `rustfmt`.
Fix it and run `cargo fmt`.
2020-12-21 19:59:31 -05:00

21 lines
493 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo -n "Checking for tabs..."
(git grep -E '^ +' -- '*.[ch]' || true) > tabdamage.txt
if test -s tabdamage.txt; then
echo "Error: tabs in .[ch] files:"
cat tabdamage.txt
exit 1
fi
echo "ok"
echo -n "checking rustfmt..."
for crate in $(find -iname Cargo.toml); do
if ! cargo fmt --manifest-path ${crate} -- --check; then
echo "cargo fmt failed; run: cd $(dirname ${crate}) && cargo fmt" 1>&2
exit 1
fi
done
echo "ok"