diff options
| -rw-r--r-- | .travis.yml | 7 | ||||
| -rwxr-xr-x | format.sh | 40 |
2 files changed, 4 insertions, 43 deletions
diff --git a/.travis.yml b/.travis.yml index add321f7ea..2fa3fd83f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,9 +54,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 -- "$@" |
