From d319f2b257596bfb434cad8ccd2854953b903ad4 Mon Sep 17 00:00:00 2001 From: Atul Bhosale Date: Fri, 6 Sep 2019 22:57:02 +0530 Subject: [PATCH] Use the latest toolchain with rustfmt available if rustfmt is unavailable on the latest nightly --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 260a75381..9664ed9ce 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