summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-02-18 23:32:31 +0100
committerLinus Färnstrand <linus@mullvad.net>2018-02-18 23:32:31 +0100
commit33a2edadad1c3b5fe7ea667f6b7ad4dd97c69ec3 (patch)
tree69ad1317bc67cfd855711ec4377029f7a08860eb
parent5f15a7bec3e2a50162e54488c5a3f519b9553586 (diff)
parent123552097e9ac2a02710ed2f43f2f36d0fd8d34d (diff)
downloadmullvadvpn-33a2edadad1c3b5fe7ea667f6b7ad4dd97c69ec3.tar.xz
mullvadvpn-33a2edadad1c3b5fe7ea667f6b7ad4dd97c69ec3.zip
Merge branch 'use-rustfmt-preview-component'
-rw-r--r--.travis.yml12
-rwxr-xr-xformat.sh40
-rw-r--r--mullvad-types/src/relay_constraints.rs6
-rw-r--r--rustfmt.toml2
4 files changed, 11 insertions, 49 deletions
diff --git a/.travis.yml b/.travis.yml
index add321f7ea..5bbb37edfb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,20 +32,19 @@ matrix:
- yarn test
- # Backend macOS
+ # Daemon - macOS
- language: rust
rust: stable
os: osx
cache: cargo
before_script: &rust_before_script
- - export PATH=$HOME/.cargo/bin:$HOME/.local/bin:$PATH
- env
script: &rust_script
- cargo build --verbose
- cargo test --verbose
- # Backend Linux
+ # Daemon - Linux
- language: rust
rust: nightly
os: linux
@@ -54,9 +53,10 @@ matrix:
script:
- cargo build --verbose
- cargo test --verbose
- # Format only on nightly, since that is where rustfmt-nightly compiles
- - export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH
- - ./format.sh --write-mode=diff;
+ # Install and run rustfmt on nightly only until rustfmt.toml settings are stabilized.
+ - rustup component add rustfmt-preview
+ - rustfmt --version
+ - cargo fmt -- --write-mode=diff
- language: rust
rust: beta
diff --git a/format.sh b/format.sh
deleted file mode 100755
index 8fe6fd7787..0000000000
--- a/format.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#! /usr/bin/env bash
-
-# Will make sure you have rustfmt at the version in $VERSION, then format all the source code.
-# Run with --only-format as the first argument to skip checking rustfmt version.
-
-set -u
-
-VERSION=`grep "required_version" rustfmt.toml | cut -f2 -d'"'`
-CMD="rustfmt"
-INSTALL_CMD="cargo +nightly install --vers $VERSION --force rustfmt-nightly"
-
-case "$(uname -s)" in
- Linux*) export LD_LIBRARY_PATH=$(rustc +nightly --print sysroot)/lib;;
- Darwin*) export DYLD_LIBRARY_PATH=$(rustc +nightly --print sysroot)/lib;;
-esac
-
-function correct_rustfmt() {
- if ! which $CMD; then
- echo "$CMD is not installed" >&2
- return 1
- fi
- local installed_version=$($CMD --version | cut -d'-' -f1)
- if [[ "$installed_version" != "$VERSION" ]]; then
- echo "Wrong version of $CMD installed. Expected $VERSION, got $installed_version" >&2
- return 1
- fi
- return 0
-}
-
-if [[ "${1:-""}" != "--only-format" ]]; then
- if ! correct_rustfmt; then
- echo "Installing $CMD $VERSION"
- $INSTALL_CMD
- fi
-else
- shift
-fi
-
-echo "Formatting with $VERSION..."
-cargo +nightly fmt -- "$@"
diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs
index 3d446b2541..b61733200b 100644
--- a/mullvad-types/src/relay_constraints.rs
+++ b/mullvad-types/src/relay_constraints.rs
@@ -101,8 +101,10 @@ pub enum LocationConstraint {
#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Serialize)]
pub enum TunnelConstraints {
- #[serde(rename = "openvpn")] OpenVpn(OpenVpnConstraints),
- #[serde(rename = "wireguard")] Wireguard(WireguardConstraints),
+ #[serde(rename = "openvpn")]
+ OpenVpn(OpenVpnConstraints),
+ #[serde(rename = "wireguard")]
+ Wireguard(WireguardConstraints),
}
impl Match<OpenVpnParameters> for TunnelConstraints {
diff --git a/rustfmt.toml b/rustfmt.toml
index 4af6ba9f6d..9d1db87d00 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,4 +1,4 @@
-required_version = "0.3.6"
+required_version = "0.3.8"
# Activation of features, almost objectively better ;)
reorder_imports = true