diff --git a/.travis.yml b/.travis.yml index 260a753..9664ed9 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