From 472902a2ce2078f3a809134a5606057691e0aafa Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 14 Oct 2022 09:48:54 +0200 Subject: [PATCH 1/3] Test that we can compile with --no-default-features --features std --- .github/workflows/rust.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e2c51ca..c551724 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -32,6 +32,11 @@ jobs: with: command: test args: --no-default-features --features compile-time-rng + - name: check fixed-seed + uses: actions-rs/cargo@v1 + with: + command: check + args: --no-default-features --features std - name: check uses: actions-rs/cargo@v1 with: From 42462276285da4af82c10dc55ccf45ab0bcb422b Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 14 Oct 2022 09:51:14 +0200 Subject: [PATCH 2/3] Fix compilation with --no-default-features --features std --- src/random_state.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/random_state.rs b/src/random_state.rs index b750bcd..cd15f92 100644 --- a/src/random_state.rs +++ b/src/random_state.rs @@ -210,7 +210,6 @@ impl fmt::Debug for RandomState { impl RandomState { /// Use randomly generated keys #[inline] - #[cfg(any(feature = "compile-time-rng", feature = "runtime-rng"))] pub fn new() -> RandomState { let src = get_src(); let fixed = get_fixed_seeds(); @@ -287,7 +286,6 @@ impl RandomState { } } -#[cfg(any(feature = "compile-time-rng", feature = "runtime-rng"))] impl Default for RandomState { #[inline] fn default() -> Self { From 276b6bbfe00155eb97e563d22bb1df52d4e81abe Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 14 Oct 2022 10:01:58 +0200 Subject: [PATCH 3/3] Add examples to doc when `std` is there --- src/lib.rs | 4 ++-- src/random_state.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8c146bf..83ffb47 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,8 +8,8 @@ //! //! aHash uses the hardware AES instruction on x86 processors to provide a keyed hash function. //! aHash is not a cryptographically secure hash. -//! -#![cfg_attr(any(feature = "compile-time-rng", feature = "runtime-rng"), doc = r##" +//! +#![cfg_attr(feature = "std", doc = r##" # Example ``` use ahash::{AHasher, RandomState}; diff --git a/src/random_state.rs b/src/random_state.rs index cd15f92..8aabc50 100644 --- a/src/random_state.rs +++ b/src/random_state.rs @@ -301,7 +301,7 @@ impl BuildHasher for RandomState { /// [AHasher]s that will return different hashcodes, but [Hasher]s created from the same [BuildHasher] /// will generate the same hashes for the same input data. /// - #[cfg_attr(any(feature = "compile-time-rng", feature = "runtime-rng"), doc = r##" # Examples + #[cfg_attr(feature = "std", doc = r##" # Examples ``` use ahash::{AHasher, RandomState}; use std::hash::{Hasher, BuildHasher};