Check for cargo fmt rather than checking for rustfmt directly.

This commit is contained in:
Dan Gohman
2018-11-26 03:50:50 -08:00
parent d94e027c2a
commit 990e1386f5

View File

@@ -27,13 +27,13 @@ function banner {
# Run rustfmt if we have it.
banner "Rust formatting"
if type rustfmt > /dev/null; then
if cargo +stable fmt -- --version > /dev/null ; then
if ! "$topdir/format-all.sh" --check ; then
echo "Formatting diffs detected! Run \"cargo fmt --all\" to correct."
exit 1
fi
else
echo "rustfmt not available; formatting not checked!"
echo "cargo-fmt not available; formatting not checked!"
echo
echo "If you are using rustup, rustfmt can be installed via"
echo "\"rustup component add --toolchain=stable rustfmt-preview\", or see"