diff options
-rwxr-xr-x | ci/assert-rustfmt.sh | 7 | ||||
-rwxr-xr-x | ci/script.sh | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/ci/assert-rustfmt.sh b/ci/assert-rustfmt.sh index de8ede82..785530cb 100755 --- a/ci/assert-rustfmt.sh +++ b/ci/assert-rustfmt.sh @@ -3,10 +3,11 @@ set -xeu cd "$(dirname "$0")/.." -rustup update nightly -rustup component add rustfmt --toolchain nightly +TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)" +rustup update "$TOOLCHAIN" +rustup component add rustfmt --toolchain "$TOOLCHAIN" # Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it # prints an error and exits non-zero, so tell it to kindly shut its yapper and # make sure it doesn't cause us to exit this whole script non-zero. -rustup run nightly cargo fmt -- --check +rustup run "$TOOLCHAIN" cargo fmt -- --check diff --git a/ci/script.sh b/ci/script.sh index e5f64f96..967defc1 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -17,10 +17,10 @@ fi case "$BINDGEN_JOB" in "test") # Need rustfmt to compare the test expectations. - rustup update nightly - rustup component add rustfmt - rustup component add --toolchain nightly rustfmt - RUSTFMT="$(rustup which rustfmt)" + TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)" + rustup update "$TOOLCHAIN" + rustup component add rustfmt --toolchain "$TOOLCHAIN" + RUSTFMT="$(rustup which --toolchain "$TOOLCHAIN" rustfmt)" export RUSTFMT cargo test "$BINDGEN_PROFILE" $NO_DEFAULT_FEATURES --features "$BINDGEN_FEATURES" ./ci/assert-no-diff.sh |