Skip to content

Commit 0de049e

Browse files
committed
ci: always try to find a nightly toolchain with rustfmt.
1 parent 8078ad6 commit 0de049e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

ci/assert-rustfmt.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
set -xeu
44
cd "$(dirname "$0")/.."
55

6-
rustup update nightly
7-
rustup component add rustfmt --toolchain nightly
6+
TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)"
7+
rustup update "$TOOLCHAIN"
8+
rustup component add rustfmt --toolchain "$TOOLCHAIN"
89

910
# Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it
1011
# prints an error and exits non-zero, so tell it to kindly shut its yapper and
1112
# make sure it doesn't cause us to exit this whole script non-zero.
12-
rustup run nightly cargo fmt -- --check
13+
rustup run "$TOOLCHAIN" cargo fmt -- --check

ci/script.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ fi
1717
case "$BINDGEN_JOB" in
1818
"test")
1919
# Need rustfmt to compare the test expectations.
20-
rustup update nightly
21-
rustup component add rustfmt
22-
rustup component add --toolchain nightly rustfmt
23-
RUSTFMT="$(rustup which rustfmt)"
20+
TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)"
21+
rustup update "$TOOLCHAIN"
22+
rustup component add rustfmt --toolchain "$TOOLCHAIN"
23+
RUSTFMT="$(rustup which --toolchain "$TOOLCHAIN" rustfmt)"
2424
export RUSTFMT
2525
cargo test "$BINDGEN_PROFILE" $NO_DEFAULT_FEATURES --features "$BINDGEN_FEATURES"
2626
./ci/assert-no-diff.sh

0 commit comments

Comments
 (0)