From 22dec87aac43e0e92eb15fa85b2de6da5b3c95b7 Mon Sep 17 00:00:00 2001 From: Diggory Hardy Date: Sat, 23 Jan 2021 16:25:02 +0000 Subject: [PATCH] CI: more accurate no-default-feature and nightly test targets Also more accurate flags in examples --- .github/workflows/test.yml | 7 ++++--- examples/monte-carlo.rs | 2 +- examples/monty-hall.rs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 740cfc8b..4c51fce7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -73,14 +73,15 @@ jobs: - name: Maybe nightly if: ${{ matrix.toolchain == 'nightly' }} run: | - cargo test --target ${{ matrix.target }} --tests --features=nightly + cargo test --target ${{ matrix.target }} --features=nightly cargo test --target ${{ matrix.target }} --all-features cargo test --target ${{ matrix.target }} --benches --features=nightly cargo test --target ${{ matrix.target }} --manifest-path rand_distr/Cargo.toml --benches - name: Test rand run: | - cargo test --target ${{ matrix.target }} --tests --no-default-features - cargo test --target ${{ matrix.target }} --tests --no-default-features --features=alloc,getrandom,small_rng + cargo test --target ${{ matrix.target }} --lib --tests --no-default-features + cargo build --target ${{ matrix.target }} --no-default-features --features alloc,getrandom,small_rng + cargo test --target ${{ matrix.target }} --lib --tests --no-default-features --features=alloc,getrandom,small_rng # all stable features: cargo test --target ${{ matrix.target }} --features=serde1,log,small_rng cargo test --target ${{ matrix.target }} --examples diff --git a/examples/monte-carlo.rs b/examples/monte-carlo.rs index 70560d0f..6cc9f4e1 100644 --- a/examples/monte-carlo.rs +++ b/examples/monte-carlo.rs @@ -24,7 +24,7 @@ //! the square at random, calculate the fraction that fall within the circle, //! and multiply this fraction by 4. -#![cfg(feature = "std")] +#![cfg(all(feature = "std", feature = "std_rng"))] use rand::distributions::{Distribution, Uniform}; diff --git a/examples/monty-hall.rs b/examples/monty-hall.rs index 30e2f44d..2a3b63d8 100644 --- a/examples/monty-hall.rs +++ b/examples/monty-hall.rs @@ -26,7 +26,7 @@ //! //! [Monty Hall Problem]: https://en.wikipedia.org/wiki/Monty_Hall_problem -#![cfg(feature = "std")] +#![cfg(all(feature = "std", feature = "std_rng"))] use rand::distributions::{Distribution, Uniform}; use rand::Rng;