diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-02-15 20:43:41 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-02-18 23:20:52 +0100 |
| commit | a31c2ccd686ed3dae59edba4dc4b71156e136f9b (patch) | |
| tree | b524fa21cf9f2b1971e877d7393e82619acc9e89 /format.sh | |
| parent | 5f15a7bec3e2a50162e54488c5a3f519b9553586 (diff) | |
| download | mullvadvpn-a31c2ccd686ed3dae59edba4dc4b71156e136f9b.tar.xz mullvadvpn-a31c2ccd686ed3dae59edba4dc4b71156e136f9b.zip | |
Remove format.sh and use rustfmt-preview
Diffstat (limited to 'format.sh')
| -rwxr-xr-x | format.sh | 40 |
1 files changed, 0 insertions, 40 deletions
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 -- "$@" |
