diff --git a/src/ff/prime_field.rs b/src/ff/prime_field.rs index ae35d59ab..49962a83d 100644 --- a/src/ff/prime_field.rs +++ b/src/ff/prime_field.rs @@ -208,6 +208,7 @@ macro_rules! field_impl { proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] fn serde(v in 0..$field::PRIME) { let field_v = $field(v); let mut buf = GenericArray::default(); diff --git a/src/helpers/buffers/ordering_mpsc.rs b/src/helpers/buffers/ordering_mpsc.rs index 1eb2bdd9b..1968e1f87 100644 --- a/src/helpers/buffers/ordering_mpsc.rs +++ b/src/helpers/buffers/ordering_mpsc.rs @@ -297,6 +297,8 @@ mod fixture { #[async_trait] impl TestSender for OrderingMpscSender { + // I don't understand what triggers this warning, maybe https://github.com/rust-lang/rust-clippy/issues/11403 + #[allow(clippy::ignored_unit_patterns)] async fn send_test(&self, i: usize) { self.send( i, @@ -383,7 +385,7 @@ mod unit { let send = async move { tx_a.send(0, input).await.unwrap(); }; - let (_, output) = join(send, rx.take_next(1)).await; + let ((), output) = join(send, rx.take_next(1)).await; assert_eq!( input, Fp31::deserialize(GenericArray::from_slice(output.as_ref().unwrap())) @@ -506,6 +508,7 @@ mod proptests { proptest::proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn arbitrary_size_seq(cap in 2..1000_usize) { let indices = (0..cap).collect::>(); tokio::runtime::Builder::new_multi_thread() @@ -516,6 +519,7 @@ mod proptests { } #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn arbitrary_size_shuffle(indices in shuffled(), excess in 0..10_usize) { tokio::runtime::Builder::new_multi_thread() .enable_all() diff --git a/src/helpers/buffers/ordering_sender.rs b/src/helpers/buffers/ordering_sender.rs index 1c490a3e9..d74a3f11b 100644 --- a/src/helpers/buffers/ordering_sender.rs +++ b/src/helpers/buffers/ordering_sender.rs @@ -533,7 +533,7 @@ mod test { values.resize_with(COUNT, || rng.gen::()); let sender = sender(); - let (_, _, output) = join3( + let (_, (), output) = join3( join_all(values.iter().enumerate().map(|(i, &v)| sender.send(i, v))), sender.close(values.len()), sender.as_stream().collect::>(), @@ -568,7 +568,7 @@ mod test { let indices = shuffle_indices(COUNT); let sender = sender(); - let (_, _, output) = join3( + let (_, (), output) = join3( join_all(indices.into_iter().map(|i| sender.send(i, values[i]))), sender.close(values.len()), sender.as_stream().collect::>(), diff --git a/src/helpers/gateway/mod.rs b/src/helpers/gateway/mod.rs index 4a92fe31a..ead1f32dc 100644 --- a/src/helpers/gateway/mod.rs +++ b/src/helpers/gateway/mod.rs @@ -180,7 +180,7 @@ mod tests { let world = TestWorld::new_with(config); world - .semi_honest((), |ctx, _| async move { + .semi_honest((), |ctx, ()| async move { let fp2_ctx = ctx.narrow("fp2").set_total_records(100); let fp32_ctx = ctx.narrow("fp32").set_total_records(100); let role = ctx.role(); diff --git a/src/helpers/prss_protocol.rs b/src/helpers/prss_protocol.rs index 48a9b760e..e44fec8ed 100644 --- a/src/helpers/prss_protocol.rs +++ b/src/helpers/prss_protocol.rs @@ -47,7 +47,7 @@ pub async fn negotiate( let (send_left_pk, send_right_pk) = ep_setup.public_keys(); let record_id = RecordId::FIRST; - let (_, _, recv_left_pk, recv_right_pk) = try_join4( + let ((), (), recv_left_pk, recv_right_pk) = try_join4( left_sender.send(record_id, send_left_pk), right_sender.send(record_id, send_right_pk), left_receiver.receive(record_id), diff --git a/src/helpers/transport/stream/input.rs b/src/helpers/transport/stream/input.rs index d7dddee23..2ca6e4a22 100644 --- a/src/helpers/transport/stream/input.rs +++ b/src/helpers/transport/stream/input.rs @@ -712,6 +712,7 @@ mod test { proptest::proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn test_records_stream_works_with_any_chunks( (expected_bytes, chunked_bytes, _seed) in arb_expected_and_chunked_body(30, 100) ) { @@ -820,6 +821,7 @@ mod test { proptest::proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn test_delimited_stream_works_with_any_chunks( (expected_items, chunked_bytes, _seed) in arb_expected_and_chunked_body(100) ) { diff --git a/src/hpke/mod.rs b/src/hpke/mod.rs index 72257f5d8..2e940f05a 100644 --- a/src/hpke/mod.rs +++ b/src/hpke/mod.rs @@ -359,6 +359,7 @@ mod tests { proptest::proptest! { #![proptest_config(ProptestConfig::with_cases(50))] #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn arbitrary_ct_corruption(bad_byte in 0..23_usize, bad_bit in 0..7_usize, seed: [u8; 32]) { let rng = StdRng::from_seed(seed); let mut suite = EncryptionSuite::new(1, rng); @@ -372,6 +373,7 @@ mod tests { proptest::proptest! { #![proptest_config(ProptestConfig::with_cases(50))] #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn arbitrary_enc_corruption(bad_byte in 0..32_usize, bad_bit in 0..7_usize, seed: [u8; 32]) { let rng = StdRng::from_seed(seed); let mut suite = EncryptionSuite::new(1, rng); @@ -416,6 +418,7 @@ mod tests { proptest::proptest! { #![proptest_config(ProptestConfig::with_cases(50))] #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn arbitrary_info_corruption(corrupted_info_field in 1..5, site_domain in "[a-z]{10}", helper_origin in "[a-z]{10}", diff --git a/src/protocol/boolean/comparison.rs b/src/protocol/boolean/comparison.rs index 6d7360b2d..148117854 100644 --- a/src/protocol/boolean/comparison.rs +++ b/src/protocol/boolean/comparison.rs @@ -558,6 +558,7 @@ mod tests { proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn gt_fp31_proptest(a in 0..Fp31::PRIME, c in 0..Fp31::PRIME) { type F = Fp31; let r = thread_rng().gen::(); @@ -566,6 +567,7 @@ mod tests { } #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn gt_fp_32bit_prime_proptest(a in 0..Fp32BitPrime::PRIME, c in 0..Fp32BitPrime::PRIME) { type F = Fp32BitPrime; let r = thread_rng().gen::(); diff --git a/src/protocol/boolean/random_bits_generator.rs b/src/protocol/boolean/random_bits_generator.rs index df99f62ba..520648dee 100644 --- a/src/protocol/boolean/random_bits_generator.rs +++ b/src/protocol/boolean/random_bits_generator.rs @@ -147,7 +147,7 @@ mod tests { for _ in 0..OUTER { let v = world - .semi_honest((), |ctx, _| async move { + .semi_honest((), |ctx, ()| async move { let validator = ctx.validator(); let ctx = validator .context() diff --git a/src/protocol/context/mod.rs b/src/protocol/context/mod.rs index cf445ae95..48b1efec9 100644 --- a/src/protocol/context/mod.rs +++ b/src/protocol/context/mod.rs @@ -352,7 +352,7 @@ mod tests { let send_channel = ctx.send_channel(left_peer); let recv_channel = ctx.recv_channel::(right_peer); - let (_, right_share) = try_join!( + let ((), right_share) = try_join!( send_channel.send(record_id, share.l() - l - seq_l), recv_channel.receive(record_id), ) diff --git a/src/protocol/dp/insecure.rs b/src/protocol/dp/insecure.rs index c4bf7c5a0..a1f3a9dfe 100644 --- a/src/protocol/dp/insecure.rs +++ b/src/protocol/dp/insecure.rs @@ -197,6 +197,7 @@ mod test { proptest! { #![proptest_config(ProptestConfig::with_cases(50))] #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn output_differentially_private( rng_seed: u64, epsilon in 1..255_u8, diff --git a/src/protocol/ipa/mod.rs b/src/protocol/ipa/mod.rs index daa5f68f8..eca798743 100644 --- a/src/protocol/ipa/mod.rs +++ b/src/protocol/ipa/mod.rs @@ -961,6 +961,7 @@ pub mod tests { proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn serde(timestamp in 0..u128::MAX, match_key in 0..u64::MAX, trigger_bit in 0..u128::MAX, breakdown_key in 0..u128::MAX, trigger_value in 0..u128::MAX, seed in 0..u128::MAX) { serde_internal::(timestamp, match_key, trigger_bit, breakdown_key, trigger_value, seed); serde_internal::(timestamp, match_key, trigger_bit, breakdown_key, trigger_value, seed); diff --git a/src/telemetry/stats.rs b/src/telemetry/stats.rs index 638248f44..d8790033c 100644 --- a/src/telemetry/stats.rs +++ b/src/telemetry/stats.rs @@ -46,10 +46,7 @@ impl CounterDetails { }; for label in key.key().labels() { let (label_key, label_val) = label.clone().into_parts(); - let dimension_values = self - .dimensions - .entry(label_key) - .or_insert_with(HashMap::new); + let dimension_values = self.dimensions.entry(label_key).or_default(); *dimension_values.entry(label_val).or_insert(0) += val; } @@ -85,10 +82,7 @@ impl Metrics { if !filter_fn(labels.as_slice()) { continue; } - let entry = this - .counters - .entry(key_name.clone()) - .or_insert_with(CounterDetails::default); + let entry = this.counters.entry(key_name.clone()).or_default(); if let Some(descr) = descr { this.metric_description.insert(key_name, descr); diff --git a/src/test_fixture/event_gen.rs b/src/test_fixture/event_gen.rs index 5ffab9020..23f995a7e 100644 --- a/src/test_fixture/event_gen.rs +++ b/src/test_fixture/event_gen.rs @@ -413,6 +413,7 @@ mod tests { proptest! { #[test] + #[allow(clippy::ignored_unit_patterns)] // https://github.com/proptest-rs/proptest/issues/371 fn iter_test(rng_seed: u64, config in arb_config(), total_events in 1_usize..2000) { does_not_exceed_config_maximums(rng_seed, &config, total_events); }