summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml6
-rwxr-xr-xci/ci-rust-script.sh29
-rw-r--r--mullvad-jni/src/lib.rs4
3 files changed, 19 insertions, 20 deletions
diff --git a/.travis.yml b/.travis.yml
index de1d81d3b7..07631d4334 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -127,11 +127,6 @@ matrix:
name: Daemon, Windows - stable Rust
env: RUST_VERSION=stable
language: bash
- install: &rust_windows_install
- - curl -sSf -o rustup-init.exe https://win.rustup.rs/
- - ./rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain $RUST_VERSION --profile minimal
- - export PATH="$HOME/.cargo/bin/:$PATH"
- - export PATH="/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/amd64/:$PATH"
script: &rust_windows_script
- ./ci/ci-rust-script.sh $RUST_VERSION
@@ -139,7 +134,6 @@ matrix:
name: Daemon, Windows - beta Rust
env: RUST_VERSION=beta
language: bash
- install: *rust_windows_install
script: *rust_windows_script
diff --git a/ci/ci-rust-script.sh b/ci/ci-rust-script.sh
index 0086936dbc..1afeaefa8e 100755
--- a/ci/ci-rust-script.sh
+++ b/ci/ci-rust-script.sh
@@ -1,26 +1,33 @@
#!/usr/bin/env bash
-set -eu
+set -eux
RUST_TOOLCHAIN_CHANNEL=$1
RUSTFLAGS="--deny unused_imports --deny dead_code"
source env.sh ""
-RUST_EXTRA_COMPONENTS=""
-if [ "${RUST_TOOLCHAIN_CHANNEL}" = "nightly" ]; then
- RUST_EXTRA_COMPONENTS+=" -c rustfmt-preview"
-fi
+case "$(uname -s)" in
+ Linux*|Darwin*)
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
+ -y --default-toolchain none --profile minimal
+ ;;
+ MINGW*|MSYS_NT*)
+ curl -sSf -o rustup-init.exe https://win.rustup.rs/
+ ./rustup-init.exe -y --default-toolchain none --profile minimal --default-host x86_64-pc-windows-msvc
+ # See https://github.com/rust-lang/rustup.rs/issues/2082
+ RUST_TOOLCHAIN_CHANNEL="$RUST_TOOLCHAIN_CHANNEL-x86_64-pc-windows-msvc"
+ ;;
+esac
+export PATH="$HOME/.cargo/bin/:$PATH"
-# Install Rust if on Linux or macOS
-if [[ "$(uname -s)" == "Linux" || "$(uname -s)" == "Darwin" ]]; then
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- \
- -y --default-toolchain $RUST_TOOLCHAIN_CHANNEL --profile minimal $RUST_EXTRA_COMPONENTS
- source $HOME/.cargo/env
-fi
+# Install the toolchain together with rustfmt. Here -c backtracks to last version where
+# the component was available.
+time rustup toolchain install $RUST_TOOLCHAIN_CHANNEL --no-self-update -c rustfmt
case "$(uname -s)" in
MINGW*|MSYS_NT*)
+ export PATH="/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/amd64/:$PATH"
time ./build_windows_modules.sh --dev-build
;;
esac
diff --git a/mullvad-jni/src/lib.rs b/mullvad-jni/src/lib.rs
index bcce35d6b3..049657bbb9 100644
--- a/mullvad-jni/src/lib.rs
+++ b/mullvad-jni/src/lib.rs
@@ -333,9 +333,7 @@ pub extern "system" fn Java_net_mullvad_mullvadvpn_MullvadDaemon_getWwwAuthToken
_: JObject<'this>,
) -> JString<'env> {
match DAEMON_INTERFACE.get_www_auth_token() {
- Ok(token) => {
- token.into_java(&env)
- },
+ Ok(token) => token.into_java(&env),
Err(err) => {
log::error!(
"{}",