]> git.lizzy.rs Git - rust.git/blobdiff - .travis.yml
Generate new lints easily
[rust.git] / .travis.yml
index bbf084259ff01933cb5d19a8d3497281807f1bdf..bd3003d45977ec152a9f11c2db8b4a6adc0d211f 100644 (file)
@@ -26,13 +26,23 @@ env:
 
 before_install:
   - export CARGO_TARGET_DIR="$TRAVIS_BUILD_DIR/target"
-  - curl -sSL https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly --profile=minimal
+  - |
+    case "$TRAVIS_OS_NAME" in
+      linux ) HOST=x86_64-unknown-linux-gnu;;
+      osx ) HOST=x86_64-apple-darwin;;
+      windows ) HOST=x86_64-pc-windows-msvc;;
+    esac
+  - curl -sSL https://sh.rustup.rs | sh -s -- -y --default-host="$HOST" --default-toolchain=nightly --profile=minimal
   - export PATH="$HOME/.cargo/bin:$PATH"
 install:
   - |
     if [[ -z ${INTEGRATION} ]]; then
       if ! rustup component add rustfmt; then
-        cargo install --git https://github.com/rust-lang/rustfmt --bin rustfmt
+        TARGET=$(rustc -Vv | awk '/host/{print $2}')
+        NIGHTLY=$(curl -s "https://rust-lang.github.io/rustup-components-history/${TARGET}/rustfmt")
+        curl -sSL "https://static.rust-lang.org/dist/${NIGHTLY}/rustfmt-nightly-${TARGET}.tar.xz" | \
+        tar -xJf - --strip-components=3 -C ~/.cargo/bin
+        rm -rf ~/.cargo/bin/doc
       fi
       if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
         . $HOME/.nvm/nvm.sh