2018-11-29 17:32:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if ! which rustup &> /dev/null; then
|
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
|
|
|
export PATH=$PATH:$HOME/.cargo/bin
|
|
|
|
if ! which rustup &> /dev/null; then
|
|
|
|
echo "Failed to install rustup"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-12 21:47:09 +00:00
|
|
|
if ! rustup component list|grep rustfmt &> /dev/null; then
|
|
|
|
echo "Installing rustfmt.."
|
|
|
|
rustup component add rustfmt
|
2018-11-29 17:32:33 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "--Checking style--"
|
2018-12-12 21:47:09 +00:00
|
|
|
cargo fmt --all -- --check
|
2018-11-29 17:32:33 +00:00
|
|
|
if test $? != 0; then
|
|
|
|
echo "--Checking style fail--"
|
2018-12-12 21:47:09 +00:00
|
|
|
echo "Please fix the above issues, either manually or by running: cargo fmt --all"
|
2018-11-29 17:32:33 +00:00
|
|
|
|
|
|
|
exit -1
|
|
|
|
else
|
|
|
|
echo "--Checking style pass--"
|
|
|
|
fi
|