summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-08-29 09:28:14 +0200
committerLinus Färnstrand <linus@mullvad.net>2017-09-18 22:38:11 +0200
commit541de45e2d6cbca39f16c4a865f1447af8ba585c (patch)
treef05e6097b05f5e25084a14cc12292f9b638c3793
parentb572d0634b78d3de05ce39e5a49ce893c8065d6b (diff)
downloadmullvadvpn-541de45e2d6cbca39f16c4a865f1447af8ba585c.tar.xz
mullvadvpn-541de45e2d6cbca39f16c4a865f1447af8ba585c.zip
Upgrade to rustfmt-nightly 0.2.6
-rw-r--r--.travis.yml13
-rwxr-xr-xformat.sh8
-rw-r--r--rustfmt.toml7
3 files changed, 13 insertions, 15 deletions
diff --git a/.travis.yml b/.travis.yml
index 8762ae3a03..af5254cff2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,9 @@
language: rust
cache: cargo
rust:
+ - nightly
- stable
- beta
- - nightly
-matrix:
- allow_failures:
- - rust: nightly
os:
- linux
- osx
@@ -18,7 +15,13 @@ before_script:
script:
- cargo build --all --verbose
- cargo test --all --verbose
- - ./format.sh --write-mode=diff
+ # Format only on nightly, since that is where rustfmt-nightly compiles
+ - if [ "${TRAVIS_RUST_VERSION}" = "nightly" ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then
+ export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH
+ && ./format.sh --write-mode=diff;
+ else
+ echo "Not checking formatting on this build";
+ fi
notifications:
email:
diff --git a/format.sh b/format.sh
index 0a899a7f73..b14aa48458 100755
--- a/format.sh
+++ b/format.sh
@@ -5,16 +5,16 @@
set -u
-VERSION="0.8.3"
+VERSION="0.2.6"
CMD="rustfmt"
-INSTALL_CMD="cargo install --vers $VERSION --force $CMD"
+INSTALL_CMD="cargo install --vers $VERSION --force rustfmt-nightly"
function correct_rustfmt() {
if ! which $CMD; then
echo "$CMD is not installed" >&2
return 1
fi
- local installed_version=$($CMD --version | cut -d' ' -f1)
+ 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
@@ -31,4 +31,4 @@ else
shift
fi
-find . -iname "*.rs" -not -path "*/target/*" -print0 | xargs -0 -n1 rustfmt "$@"
+find . -iname "*.rs" -not -path "*/target/*" -print0 | xargs -0 -n1 rustfmt --skip-children "$@"
diff --git a/rustfmt.toml b/rustfmt.toml
index d56f55c24d..48d9efb99e 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,6 +1,6 @@
# Activation of features, almost objectively better ;)
reorder_imports = true
-reorder_imported_names = true
+reorder_imports_in_group = true
use_try_shorthand = true
condense_wildcard_suffices = true
normalize_comments = true
@@ -9,8 +9,3 @@ wrap_comments = true
# Heavily subjective style choices
comment_width = 100
chain_one_line_max = 100
-array_layout = "Block"
-fn_call_style = "Block"
-take_source_hints = true
-
-write_mode = "Overwrite"