diff options
Diffstat (limited to 'format.sh')
| -rwxr-xr-x | format.sh | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -5,16 +5,25 @@ set -u -VERSION="0.2.16" +VERSION="0.2.17" CMD="rustfmt" INSTALL_CMD="cargo install --vers $VERSION --force rustfmt-nightly" +case "$(uname -s)" in + Linux*) export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib;; + Darwin*) export DYLD_LIBRARY_PATH=$(rustc --print sysroot)/lib;; + *) exit 1 +esac + +# Allow rustfmt to use "nighly" features. `comment_width` is one of those for example. +# 0.2.17 started enforcing setting this variable to allow using the nighly features. +export CFG_RELEASE_CHANNEL=nightly + function correct_rustfmt() { if ! which $CMD; then echo "$CMD is not installed" >&2 return 1 fi - export DYLD_LIBRARY_PATH=$(rustc --print sysroot)/lib 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 |
