summaryrefslogtreecommitdiffhomepage
path: root/ci/travis-rust-script.sh
blob: d447cd8ea158fcbf01c723ca87c2aeca68e4d53b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
set -eu
RUST_TOOLCHAIN_CHANNEL=$1
RUSTFLAGS="--deny unused_imports --deny dead_code"

source env.sh ""
rustup update $RUST_TOOLCHAIN_CHANNEL
rustup default $RUST_TOOLCHAIN_CHANNEL

cargo build --verbose
cargo test --verbose
if [ "${RUST_TOOLCHAIN_CHANNEL}" = "nightly" ]; then
  rustup component add rustfmt-preview;
  rustfmt --version;
  cargo fmt -- --check --unstable-features;
fi

if ! git diff-index --quiet HEAD; then
  echo "!!! Working directory is dirty !!!";
  git diff-index HEAD
  exit 1;
fi