1#!/bin/bash 2 3set -ex 4 5cmd="${1:-test}" 6 7# Install cargo-hack for feature flag test 8host=$(rustc -Vv | grep host | sed 's/host: //') 9curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-$host.tar.gz | tar xzf - -C ~/.cargo/bin 10 11# Run with each feature 12# * --each-feature includes both default/no-default features 13# * --optional-deps is needed for serde feature 14cargo hack "${cmd}" --each-feature --optional-deps 15# Run with all features 16cargo "${cmd}" --all-features 17 18cargo doc --no-deps --all-features 19 20if [[ "${RUST_VERSION}" == "nightly"* ]]; then 21 # Check benchmarks 22 cargo check --benches 23 24 # Check minimal versions 25 cargo clean 26 cargo update -Zminimal-versions 27 cargo check --all-features 28fi 29