From 972b7461a0eed944e82076fef9410f9c524ec3e5 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 6 Sep 2019 22:33:04 +0900 Subject: [PATCH] Use the latest toolchain with rustfmt available if rustfmt is unavailable on the latest nightly --- ci/rustfmt.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/rustfmt.yml b/ci/rustfmt.yml index c0af2d31..b684d5fe 100644 --- a/ci/rustfmt.yml +++ b/ci/rustfmt.yml @@ -8,7 +8,13 @@ jobs: parameters: rust_version: nightly - script: | - rustup component add rustfmt + if ! rustup component add rustfmt; then + target=`curl https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rustfmt`; + echo "'rustfmt' is unavailable on the toolchain 'nightly', use the toolchain 'nightly-$target' instead"; + rustup toolchain install nightly-$target; + rustup default nightly-$target; + rustup component add rustfmt; + fi displayName: Install rustfmt - script: | cargo fmt --all -- --check --unstable-features