Check for cargo fmt rather than checking for rustfmt directly.

This commit is contained in:
Dan Gohman
2018-11-26 03:52:39 -08:00
parent ec940ee8af
commit 4dec8ecfce

View File

@@ -22,13 +22,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"