From 5d73776c6917a7db4363d5775120b55cf286d0f5 Mon Sep 17 00:00:00 2001 From: Atul Bhosale Date: Fri, 6 Sep 2019 23:33:26 +0530 Subject: [PATCH] Use the latest toolchain with rustfmt available if rustfmt is unavailable on the latest nightly (#155) --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 260a7538..9664ed9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,14 @@ matrix: - name: fmt rust: nightly os: linux - before_script: - - rustup component add rustfmt + before_script: | + 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 script: - cargo fmt --all -- --check