diff --git a/crates/dapf/src/http_client.rs b/crates/dapf/src/http_client.rs index 8d3a9729..71c178cf 100644 --- a/crates/dapf/src/http_client.rs +++ b/crates/dapf/src/http_client.rs @@ -13,7 +13,7 @@ pub struct HttpClient { inner: HttpClientInner, } -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] enum HttpClientInner { /// Never reuse the same reqwest client for two different http requests. Usefull for specific /// debugging or load testing scenarios. diff --git a/crates/dapf/src/main.rs b/crates/dapf/src/main.rs index a81c22e6..fb16a5ec 100644 --- a/crates/dapf/src/main.rs +++ b/crates/dapf/src/main.rs @@ -192,7 +192,7 @@ enum HpkeAction { } #[derive(Debug, Subcommand)] -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] enum TestAction { /// Add an hpke config to a test-utils enabled `daphne-server`. AddHpkeConfig { diff --git a/crates/daphne-server/docker/example-service.Dockerfile b/crates/daphne-server/docker/example-service.Dockerfile index 0358d863..e05970cd 100644 --- a/crates/daphne-server/docker/example-service.Dockerfile +++ b/crates/daphne-server/docker/example-service.Dockerfile @@ -1,7 +1,7 @@ # Copyright (c) 2024 Cloudflare, Inc. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause -FROM rust:1.80.1-bookworm AS builder +FROM rust:1.82-bookworm AS builder RUN apt update && \ apt install -y \ diff --git a/crates/daphne-server/src/storage_proxy_connection/kv/cache.rs b/crates/daphne-server/src/storage_proxy_connection/kv/cache.rs index c17c384d..14b806f0 100644 --- a/crates/daphne-server/src/storage_proxy_connection/kv/cache.rs +++ b/crates/daphne-server/src/storage_proxy_connection/kv/cache.rs @@ -76,7 +76,7 @@ impl Cache { ); } - #[allow(dead_code)] + #[expect(dead_code)] pub fn delete

(&mut self, key: &str) -> CacheResult where P: KvPrefix, diff --git a/crates/daphne-server/src/storage_proxy_connection/mod.rs b/crates/daphne-server/src/storage_proxy_connection/mod.rs index 19ed049e..baf2425a 100644 --- a/crates/daphne-server/src/storage_proxy_connection/mod.rs +++ b/crates/daphne-server/src/storage_proxy_connection/mod.rs @@ -42,7 +42,7 @@ impl<'h> Do<'h> { } } - #[allow(dead_code)] + #[expect(dead_code)] pub fn with_retry(self) -> Self { Self { retry: true, @@ -126,7 +126,7 @@ impl<'w> Do<'w> { } } - #[allow(dead_code)] + #[expect(dead_code)] pub fn request_with_id( &self, path: B, diff --git a/crates/daphne-server/tests/e2e/e2e.rs b/crates/daphne-server/tests/e2e/e2e.rs index 061c369b..e94e5e37 100644 --- a/crates/daphne-server/tests/e2e/e2e.rs +++ b/crates/daphne-server/tests/e2e/e2e.rs @@ -1162,7 +1162,7 @@ async fn leader_collect_taskprov_ok(version: DapVersion) { .poll_collection_url_using_token(client, &collect_uri, DAP_TASKPROV_COLLECTOR_TOKEN) .await .unwrap(); - #[allow(clippy::format_in_format_args)] + #[expect(clippy::format_in_format_args)] { assert_eq!( resp.status(), diff --git a/crates/daphne-server/tests/e2e/test_runner.rs b/crates/daphne-server/tests/e2e/test_runner.rs index 9e63e089..bd64ce28 100644 --- a/crates/daphne-server/tests/e2e/test_runner.rs +++ b/crates/daphne-server/tests/e2e/test_runner.rs @@ -359,7 +359,7 @@ impl TestRunner { get_raw_hpke_config(client, self.task_id.as_ref(), &self.helper_url, "helper").await } - #[allow(dead_code)] + #[expect(dead_code)] pub async fn leader_post_expect_ok( &self, client: &reqwest::Client, @@ -401,7 +401,7 @@ impl TestRunner { Ok(()) } - #[allow(dead_code, clippy::too_many_arguments)] + #[expect(dead_code, clippy::too_many_arguments)] pub async fn leader_post_expect_abort( &self, client: &reqwest::Client, @@ -515,7 +515,7 @@ impl TestRunner { Ok(()) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub async fn leader_put_expect_abort( &self, client: &reqwest::Client, diff --git a/crates/daphne-worker-test/docker/runtests.Dockerfile b/crates/daphne-worker-test/docker/runtests.Dockerfile index 3e8d5b6f..f04ed68d 100644 --- a/crates/daphne-worker-test/docker/runtests.Dockerfile +++ b/crates/daphne-worker-test/docker/runtests.Dockerfile @@ -1,7 +1,7 @@ # Copyright (c) 2024 Cloudflare, Inc. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause -FROM rust:1.80.1-bookworm +FROM rust:1.82-bookworm WORKDIR /tmp/dap_test diff --git a/crates/daphne-worker-test/docker/storage-proxy.Dockerfile b/crates/daphne-worker-test/docker/storage-proxy.Dockerfile index e31fd3de..f9df80c2 100644 --- a/crates/daphne-worker-test/docker/storage-proxy.Dockerfile +++ b/crates/daphne-worker-test/docker/storage-proxy.Dockerfile @@ -1,7 +1,7 @@ # Copyright (c) 2024 Cloudflare, Inc. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause -FROM rust:1.80.1-bookworm AS builder +FROM rust:1.82-bookworm AS builder RUN apt update && apt install -y capnproto clang cmake # Pre-install worker-build and Rust's wasm32 target to speed up our custom build command diff --git a/crates/daphne-worker/src/durable/mod.rs b/crates/daphne-worker/src/durable/mod.rs index 4324aaf7..9c476cd2 100644 --- a/crates/daphne-worker/src/durable/mod.rs +++ b/crates/daphne-worker/src/durable/mod.rs @@ -80,7 +80,8 @@ macro_rules! mk_durable_object { #[doc(hidden)] pub async fn fetch( &mut self, - #[allow(unused_mut)] mut req: ::worker::Request + #[cfg(feature = "test-utils")] mut req: ::worker::Request, + #[cfg(not(feature = "test-utils"))] req: ::worker::Request, ) -> ::worker::Result<::worker::Response> { use $crate::durable::{create_span_from_request, GcDurableObject}; use ::tracing::Instrument; @@ -135,7 +136,6 @@ macro_rules! mk_durable_object { &self.env } - #[allow(dead_code)] async fn get(&self, key: &str) -> ::worker::Result> where T: ::serde::de::DeserializeOwned, @@ -143,7 +143,6 @@ macro_rules! mk_durable_object { $crate::durable::state_get(&self.state, key).await } - #[allow(dead_code)] async fn get_or_default(&self, key: &str) -> ::worker::Result where T: ::serde::de::DeserializeOwned + std::default::Default, @@ -151,7 +150,7 @@ macro_rules! mk_durable_object { $crate::durable::state_get_or_default(&self.state, key).await } - #[allow(dead_code)] + #[expect(dead_code)] async fn set_if_not_exists(&self, key: &str, val: &T) -> ::worker::Result> where T: ::serde::de::DeserializeOwned + ::serde::Serialize, diff --git a/crates/daphne-worker/src/durable/test_state_cleaner.rs b/crates/daphne-worker/src/durable/test_state_cleaner.rs index 9ae442e7..93f54547 100644 --- a/crates/daphne-worker/src/durable/test_state_cleaner.rs +++ b/crates/daphne-worker/src/durable/test_state_cleaner.rs @@ -19,7 +19,6 @@ use super::GcDurableObject; /// Durable Object (DO) for keeping track of all persistent DO storage. #[durable_object] pub struct TestStateCleaner { - #[allow(dead_code)] state: State, env: Env, } diff --git a/crates/daphne-worker/src/storage_proxy/middleware.rs b/crates/daphne-worker/src/storage_proxy/middleware.rs index 7291e108..d4baaf72 100644 --- a/crates/daphne-worker/src/storage_proxy/middleware.rs +++ b/crates/daphne-worker/src/storage_proxy/middleware.rs @@ -48,10 +48,8 @@ pub async fn bearer_auth( return (StatusCode::UNAUTHORIZED, "Incorrect authorization token").into_response(); } - match next.call(request.map(axum::body::Body::new)).await { - Ok(r) => r, - Err(infalible) => match infalible {}, - } + let Ok(response) = next.call(request.map(axum::body::Body::new)).await; + response } #[worker::send] @@ -62,10 +60,7 @@ pub async fn time_kv_requests( mut next: Next, ) -> axum::response::Response { let start = worker::Date::now(); - let response = match next.call(request).await { - Ok(response) => response, - Err(infallible) => match infallible {}, - }; + let Ok(response) = next.call(request).await; let elapsed = elapsed(&start); let op = match method { @@ -97,10 +92,7 @@ pub async fn time_do_requests( mut next: Next, ) -> axum::response::Response { let start = worker::Date::now(); - let response = match next.call(request).await { - Ok(response) => response, - Err(infallible) => match infallible {}, - }; + let Ok(response) = next.call(request).await; let elapsed = elapsed(&start); ctx.metrics.durable_request_time_seconds_observe( &uri, diff --git a/crates/daphne/benches/pine.rs b/crates/daphne/benches/pine.rs index 1a4e2f36..e37c8d59 100644 --- a/crates/daphne/benches/pine.rs +++ b/crates/daphne/benches/pine.rs @@ -14,7 +14,7 @@ use prio::{ fn pine(c: &mut Criterion) { // NOTE We ignore this clippy warning because we may want to benchmark more parameters later. - #[allow(clippy::single_element_loop)] + #[expect(clippy::single_element_loop)] for (dimension, chunk_len, chunk_len_sq_norm_equal) in [(200_000, 150 * 2, 447 * 18)] { let pine = Pine::new_64(1 << 15, dimension, 15, chunk_len, chunk_len_sq_norm_equal).unwrap(); diff --git a/crates/daphne/benches/vdaf.rs b/crates/daphne/benches/vdaf.rs index 405cc830..1bb7c002 100644 --- a/crates/daphne/benches/vdaf.rs +++ b/crates/daphne/benches/vdaf.rs @@ -14,8 +14,8 @@ use prio::{ fn count_vec(c: &mut Criterion) { for dimension in [100, 1_000, 10_000, 100_000] { let nonce = [0; 16]; - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let chunk_length = (dimension as f64).sqrt() as usize; // asymptotically optimal // Prio2 diff --git a/crates/daphne/src/lib.rs b/crates/daphne/src/lib.rs index e6e6c88e..38a91bdd 100644 --- a/crates/daphne/src/lib.rs +++ b/crates/daphne/src/lib.rs @@ -546,7 +546,6 @@ pub struct DapTaskParameters { impl DapTaskParameters { /// Construct a new task config using the taskprov extension. Return the task ID and the /// taskprov advertisement encoded as a base64url string. - #[allow(clippy::type_complexity)] pub fn to_config_with_taskprov( &self, task_info: Vec, diff --git a/crates/daphne/src/messages/mod.rs b/crates/daphne/src/messages/mod.rs index 0bc69524..ab2f5aa0 100644 --- a/crates/daphne/src/messages/mod.rs +++ b/crates/daphne/src/messages/mod.rs @@ -230,7 +230,6 @@ impl ParameterizedDecode for Extension { /// Report metadata. #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)] -#[allow(missing_docs)] #[cfg_attr(any(test, feature = "test-utils"), derive(deepsize::DeepSizeOf))] pub struct ReportMetadata { pub id: ReportId, @@ -1056,7 +1055,6 @@ impl Decode for HpkeCiphertext { /// A plaintext input share. #[derive(Clone, Debug, PartialEq, Eq)] -#[allow(missing_docs)] pub struct PlaintextInputShare { pub extensions: Vec, pub payload: Vec, diff --git a/crates/daphne/src/metrics.rs b/crates/daphne/src/metrics.rs index 0ec98f1c..5fbb453d 100644 --- a/crates/daphne/src/metrics.rs +++ b/crates/daphne/src/metrics.rs @@ -84,7 +84,6 @@ pub mod prometheus { /// Register Daphne metrics with the specified registry. If a prefix is provided, then /// "{prefix_}" is prepended to the name. pub fn register(registry: &Registry) -> Result { - #[allow(clippy::ignored_unit_patterns)] let inbound_request_counter = register_int_counter_vec_with_registry!( "inbound_request_counter", "Total number of successful inbound requests.", @@ -93,7 +92,6 @@ pub mod prometheus { ) .map_err(|e| fatal_error!(err = ?e, "failed to regsiter inbound_request_counter"))?; - #[allow(clippy::ignored_unit_patterns)] let report_counter = register_int_counter_vec_with_registry!( "report_counter", "Total number reports rejected, aggregated, and collected.", @@ -102,7 +100,6 @@ pub mod prometheus { ) .map_err(|e| fatal_error!(err = ?e, "failed to register report_counter"))?; - #[allow(clippy::ignored_unit_patterns)] let aggregation_job_batch_size_histogram = register_histogram_with_registry!( "aggregation_job_batch_size", "Number of records in an incoming AggregationJobInitReq.", @@ -113,7 +110,6 @@ pub mod prometheus { ) .map_err(|e| fatal_error!(err = ?e, "failed to register aggregation_job_batch_size"))?; - #[allow(clippy::ignored_unit_patterns)] let aggregation_job_counter = register_int_counter_vec_with_registry!( format!("aggregation_job_counter"), "Total number of aggregation jobs started and completed.", @@ -122,7 +118,6 @@ pub mod prometheus { ) .map_err(|e| fatal_error!(err = ?e, "failed to register aggregation_job_counter"))?; - #[allow(clippy::ignored_unit_patterns)] let aggregation_job_put_span_retry_counter = register_int_counter_with_registry!( format!("aggregation_job_put_span_retry_counter"), diff --git a/crates/daphne/src/pine/mod.rs b/crates/daphne/src/pine/mod.rs index 7f7a2d18..42ac73a6 100644 --- a/crates/daphne/src/pine/mod.rs +++ b/crates/daphne/src/pine/mod.rs @@ -211,8 +211,8 @@ impl Pine(x: f64, two_to_frac_bits: f64) -> Re let out = x * two_to_frac_bits; let out = out.floor(); let out = if neg { -out } else { out }; - #[allow(clippy::cast_possible_truncation)] - #[allow(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] let out = out as u64; let out = usize::try_from(out).map_err(|e| { VdafError::Uncategorized(format!( @@ -375,8 +375,8 @@ fn norm_bound_f64_to_u64(norm_bound: f64, frac_bits: usize) -> u64 { let two_to_frac_bits = f64::from(1 << frac_bits); let norm_bound = norm_bound * two_to_frac_bits; let norm_bound = norm_bound.floor(); - #[allow(clippy::cast_sign_loss)] - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_sign_loss)] + #[expect(clippy::cast_possible_truncation)] let norm_bound = norm_bound as u64; norm_bound } @@ -527,7 +527,7 @@ mod tests { }, ] { // clippy: We expect the values to match precisely. - #[allow(clippy::float_cmp)] + #[expect(clippy::float_cmp)] { assert_eq!( field_to_f64( diff --git a/crates/daphne/src/pine/test_vec/mod.rs b/crates/daphne/src/pine/test_vec/mod.rs index b869c22a..47a894f3 100644 --- a/crates/daphne/src/pine/test_vec/mod.rs +++ b/crates/daphne/src/pine/test_vec/mod.rs @@ -89,7 +89,7 @@ impl TestVec { // Check that the test vector parameters have the values we expect. // // clippy: These are test vectors, so we expect the value to match precisely. - #[allow(clippy::float_cmp)] + #[expect(clippy::float_cmp)] { assert_eq!(self.alpha, ALPHA); } diff --git a/crates/daphne/src/protocol/aggregator.rs b/crates/daphne/src/protocol/aggregator.rs index df66ebef..a5c927df 100644 --- a/crates/daphne/src/protocol/aggregator.rs +++ b/crates/daphne/src/protocol/aggregator.rs @@ -255,7 +255,7 @@ impl EarlyReportState for EarlyReportStateConsumed { } /// Report state during aggregation initialization after the VDAF preparation step. -#[allow(clippy::large_enum_variant)] +#[expect(clippy::large_enum_variant)] #[derive(Clone)] #[cfg_attr(any(test, feature = "test-utils"), derive(deepsize::DeepSizeOf))] pub enum EarlyReportStateInitialized { @@ -400,7 +400,7 @@ impl ReplayProtection { impl DapTaskConfig { /// Leader -> Helper: Initialize the aggregation flow for a sequence of reports. The outputs are the Leader's /// state for the aggregation flow and the outbound `AggregationJobInitReq` message. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub async fn produce_agg_job_req( &self, decrypter: impl HpkeDecrypter, @@ -427,7 +427,7 @@ impl DapTaskConfig { .await } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] async fn produce_agg_job_req_impl( &self, decrypter: impl HpkeDecrypter, @@ -547,7 +547,7 @@ impl DapTaskConfig { )) } - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] #[cfg(any(test, feature = "test-utils"))] pub async fn test_produce_agg_job_req( &self, diff --git a/crates/daphne/src/protocol/client.rs b/crates/daphne/src/protocol/client.rs index ca62dc6f..1a44e583 100644 --- a/crates/daphne/src/protocol/client.rs +++ b/crates/daphne/src/protocol/client.rs @@ -64,7 +64,7 @@ impl VdafConfig { } /// Generate a report for the given public and input shares with the given extensions. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub(crate) fn produce_report_with_extensions_for_shares( public_share: Vec, input_shares: [Vec; 2], diff --git a/crates/daphne/src/protocol/collector.rs b/crates/daphne/src/protocol/collector.rs index 69ea3306..da8133ae 100644 --- a/crates/daphne/src/protocol/collector.rs +++ b/crates/daphne/src/protocol/collector.rs @@ -30,7 +30,7 @@ impl VdafConfig { /// Aggregators. The first encrypted aggregate shares must be the Leader's. /// /// * `version` is the `DapVersion` to use. - #[allow(clippy::too_many_arguments)] + #[expect(clippy::too_many_arguments)] pub fn consume_encrypted_agg_shares( &self, decrypter: &impl HpkeDecrypter, diff --git a/crates/daphne/src/taskprov.rs b/crates/daphne/src/taskprov.rs index 772adac8..cdd40b0c 100644 --- a/crates/daphne/src/taskprov.rs +++ b/crates/daphne/src/taskprov.rs @@ -36,7 +36,6 @@ use serde::{Deserialize, Serialize}; use url::Url; /// SHA-256 of "dap-taskprov" -#[allow(dead_code)] pub(crate) const TASKPROV_SALT: [u8; 32] = [ 0x28, 0xb9, 0xbb, 0x4f, 0x62, 0x4f, 0x67, 0x9a, 0xc1, 0x98, 0xd9, 0x68, 0xf4, 0xb0, 0x9e, 0xec, 0x74, 0x01, 0x7a, 0x52, 0xcb, 0x4c, 0xf6, 0x39, 0xfb, 0x83, 0xe0, 0x47, 0x72, 0x3a, 0x0f, 0xfe, diff --git a/crates/daphne/src/testing/mod.rs b/crates/daphne/src/testing/mod.rs index a1b29d55..f50b9c3d 100644 --- a/crates/daphne/src/testing/mod.rs +++ b/crates/daphne/src/testing/mod.rs @@ -66,7 +66,7 @@ pub struct AggregationJobTest { pub(crate) valid_report_range: Range