Skip to content

Commit 6f227ba

Browse files
authored
Use the latest toolchain with rustfmt available if rustfmt is unavailable on the latest nightly
1 parent 481002e commit 6f227ba

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ matrix:
1919
rust: nightly
2020
os: linux
2121
before_script:
22-
- rustup component add rustfmt
22+
if ! rustup component add rustfmt; then
23+
target=`curl https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/rustfmt`;
24+
echo "'rustfmt' is unavailable on the toolchain 'nightly', use the toolchain 'nightly-$target' instead";
25+
rustup toolchain install nightly-$target;
26+
rustup default nightly-$target;
27+
rustup component add rustfmt;
28+
fi
2329
script:
2430
- cargo fmt --all -- --check
2531

0 commit comments

Comments
 (0)