#!/bin/bash
set -eu

version=0.6.0

if command -v rustfmt >/dev/null; then
  if [[ $(rustfmt --version) = "$version" ]]; then
    echo "--> Detected rustfmt version $version, skipping install"
    exit 0
  fi
fi

cargo install --vers $version --force rustfmt

#!/bin/bash
set -eu

version=0.6.0

if command -v rustfmt >/dev/null; then
  if [[ $(rustfmt --version) = "$version" ]]; then
    echo "--> Detected rustfmt version $version, skipping install"
    exit 0
  fi
fi

cargo uninstall rustfmt
cargo install --vers $version rustfmt

Uninstall then install rustfmt when upgrading.
[ci/rustfmt] Uninstall then install rustfmt when upgrading.

This change is necessary if using an older version of Cargo which does
not yet support the `--force` flag on `cargo install`.

Signed-off-by: Fletcher Nichol <77a0fd9e8048bbacd11af4e957bc6ff03b549f49@nichol.ca>
