From 32aa34366c1fc6521cb18709917c7616efaa9bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Wed, 14 Jun 2023 09:49:05 +0200 Subject: [PATCH] peer_id: make quickcheck optional but default feature --- aquatic_peer_id/Cargo.toml | 5 ++++- aquatic_peer_id/src/lib.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/aquatic_peer_id/Cargo.toml b/aquatic_peer_id/Cargo.toml index 36f5553..5563c1d 100644 --- a/aquatic_peer_id/Cargo.toml +++ b/aquatic_peer_id/Cargo.toml @@ -12,9 +12,12 @@ rust-version.workspace = true [lib] name = "aquatic_peer_id" +[features] +default = ["quickcheck"] + [dependencies] compact_str = "0.7" hex = "0.4" regex = "1" serde = { version = "1", features = ["derive"] } -quickcheck = "1" \ No newline at end of file +quickcheck = { version = "1", optional = true } \ No newline at end of file diff --git a/aquatic_peer_id/src/lib.rs b/aquatic_peer_id/src/lib.rs index 6d3c790..ce1a463 100644 --- a/aquatic_peer_id/src/lib.rs +++ b/aquatic_peer_id/src/lib.rs @@ -195,6 +195,7 @@ impl Display for PeerClient { } } +#[cfg(feature = "quickcheck")] impl quickcheck::Arbitrary for PeerId { fn arbitrary(g: &mut quickcheck::Gen) -> Self { let mut bytes = [0u8; 20]; @@ -207,6 +208,7 @@ impl quickcheck::Arbitrary for PeerId { } } +#[cfg(feature = "quickcheck")] #[cfg(test)] mod tests { use super::*;