diff --git a/ci/style.sh b/ci/style.sh index 1ed8e51e658b5..e373419eb5af7 100755 --- a/ci/style.sh +++ b/ci/style.sh @@ -2,13 +2,18 @@ set -eux +if [ -n "${CI:-}" ]; then + rustup toolchain install nightly -c rustfmt --allow-downgrade + rustup override set nightly + + check="--check" +fi + rustc ci/style.rs && ./style src -rustup toolchain install nightly -c rustfmt --allow-downgrade -rustup override set nightly command -v rustfmt rustfmt -V -cargo fmt --all -- --check +cargo fmt --all -- ${check:+"$check"} if shellcheck --version ; then find . -name '*.sh' -print0 | xargs -0 shellcheck