diff --git a/ipa-core/src/helpers/buffers/unordered_receiver.rs b/ipa-core/src/helpers/buffers/unordered_receiver.rs index 92cfbf2e1..3377995cf 100644 --- a/ipa-core/src/helpers/buffers/unordered_receiver.rs +++ b/ipa-core/src/helpers/buffers/unordered_receiver.rs @@ -295,7 +295,6 @@ where inner: Arc>>, } -#[allow(dead_code)] impl UnorderedReceiver where S: Stream + Send, diff --git a/ipa-core/src/protocol/dp/mod.rs b/ipa-core/src/protocol/dp/mod.rs index b2d8b55e1..856073b77 100644 --- a/ipa-core/src/protocol/dp/mod.rs +++ b/ipa-core/src/protocol/dp/mod.rs @@ -553,7 +553,7 @@ fn delta_constraint(num_bernoulli: u32, noise_params: &NoiseParams) -> bool { lhs >= rhs } /// error of mechanism in Thm 1 -#[allow(dead_code)] +#[cfg(all(test, unit_test))] fn error(num_bernoulli: u32, noise_params: &NoiseParams) -> f64 { noise_params.dimensions * noise_params.quantization_scale.powi(2) diff --git a/ipa-core/src/protocol/ipa_prf/oprf_padding/insecure.rs b/ipa-core/src/protocol/ipa_prf/oprf_padding/insecure.rs index b7268900d..d37edfecb 100644 --- a/ipa-core/src/protocol/ipa_prf/oprf_padding/insecure.rs +++ b/ipa-core/src/protocol/ipa_prf/oprf_padding/insecure.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use std::f64::consts::E; use rand::distributions::{BernoulliError, Distribution}; @@ -77,6 +75,7 @@ impl Dp { }) } + #[cfg(all(test, unit_test))] fn apply(&self, mut input: I, rng: &mut R) where R: RngCore + CryptoRng, @@ -521,16 +520,18 @@ mod test { println!("A sample value equal to {sample} occurred {count} time(s)",); } } + + #[test] fn test_oprf_padding_dp_constructor() { let mut actual = OPRFPaddingDp::new(-1.0, 1e-6, 10); // (epsilon, delta, sensitivity) let mut expected = Err(Error::BadEpsilon(-1.0)); - assert_eq!(expected, Ok(actual)); + assert_eq!(expected, actual); actual = OPRFPaddingDp::new(1.0, -1e-6, 10); // (epsilon, delta, sensitivity) expected = Err(Error::BadDelta(-1e-6)); - assert_eq!(expected, Ok(actual)); - actual = OPRFPaddingDp::new(1.0, -1e-6, 1_000_001); // (epsilon, delta, sensitivity) + assert_eq!(expected, actual); + actual = OPRFPaddingDp::new(1.0, 1e-6, 1_000_001); // (epsilon, delta, sensitivity) expected = Err(Error::BadSensitivity(1_000_001)); - assert_eq!(expected, Ok(actual)); + assert_eq!(expected, actual); } #[test] diff --git a/ipa-core/src/protocol/ipa_prf/shuffle/base.rs b/ipa-core/src/protocol/ipa_prf/shuffle/base.rs index d999db229..83343b739 100644 --- a/ipa-core/src/protocol/ipa_prf/shuffle/base.rs +++ b/ipa-core/src/protocol/ipa_prf/shuffle/base.rs @@ -68,7 +68,6 @@ where } } -#[allow(dead_code)] /// This struct stores some intermediate messages during the shuffle. /// In a maliciously secure shuffle, /// these messages need to be checked for consistency across helpers. @@ -79,7 +78,6 @@ pub struct IntermediateShuffleMessages { x2_or_y2: Option>, } -#[allow(dead_code)] impl IntermediateShuffleMessages { /// When `IntermediateShuffleMessages` is initialized correctly, /// this function returns `x1` when `Role = H1` diff --git a/ipa-core/src/query/state.rs b/ipa-core/src/query/state.rs index 9d42a0439..460296022 100644 --- a/ipa-core/src/query/state.rs +++ b/ipa-core/src/query/state.rs @@ -19,7 +19,6 @@ use crate::{ /// The status of query processing #[derive(Copy, Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] -#[allow(dead_code)] pub enum QueryStatus { /// Only query running on the coordinator helper can be in this state. Means that coordinator /// sent out requests to other helpers and asked them to assume a given role for this query.