Skip to content

Commit

Permalink
fix: make arb feature work with no-std (#160)
Browse files Browse the repository at this point in the history
When compiled with no default features, but the `arb` feature disabled, the
compilation fails. With this change it's now possible.
  • Loading branch information
vmx authored Jun 26, 2024
1 parent 8fc2aba commit dae650c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/arb.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![cfg(feature = "arb")]

use std::convert::TryFrom;

use multihash::Multihash;
use quickcheck::Gen;
use rand::{
Expand All @@ -25,7 +23,7 @@ impl quickcheck::Arbitrary for Version {
impl<const S: usize> quickcheck::Arbitrary for CidGeneric<S> {
fn arbitrary(g: &mut Gen) -> Self {
if S >= 32 && Version::arbitrary(g) == Version::V0 {
let data = std::array::from_fn::<_, 32, _>(|_| u8::arbitrary(g));
let data = core::array::from_fn::<_, 32, _>(|_| u8::arbitrary(g));

CidGeneric::new_v0(
Multihash::wrap(SHA2_256, &data).expect("S is guaranteed to be > 32"),
Expand Down

0 comments on commit dae650c

Please sign in to comment.