language: rust

rust:
  - stable
  - beta
  - nightly

matrix:
  allow_failures:
    - rust: beta
    - rust: nightly
  fast_finish: true

before_install: |
  if [[ "$TRAVIS_RUST_VERSION" != nightly ]]; then
    rustup component add clippy
    rustup component add rustfmt
  fi

script: |
  if [[ "$TRAVIS_RUST_VERSION" != nightly ]]; then
    cargo fmt --all -- --check
    cargo clippy --all-targets --all-features -- -D warnings
  fi
  cargo test
