From 6f2e41b060547339a030ee22b4669a684b216045 Mon Sep 17 00:00:00 2001 From: Leynos Date: Mon, 2 Feb 2026 09:40:17 +0000 Subject: [PATCH 1/3] refactor(tests): replace lint suppressions with comments in fixtures Removed multiple clippy and rustc lint suppression attributes from rstest single-line fixtures in test modules. Replaced them with concise comments explaining the fixture purpose to improve code clarity and maintainability. Also applied similar style simplification in wireframe_testing source files related to fixtures and async functions. Co-authored-by: devboxerhub[bot] --- tests/app_data.rs | 34 +++++--------------- tests/connection_actor_errors.rs | 30 +++-------------- tests/connection_actor_shutdown.rs | 46 +++++++-------------------- tests/push_policies.rs | 17 +++------- wireframe_testing/src/logging.rs | 9 +++--- wireframe_testing/src/multi_packet.rs | 6 +++- 6 files changed, 38 insertions(+), 104 deletions(-) diff --git a/tests/app_data.rs b/tests/app_data.rs index 62300eef..e24143af 100644 --- a/tests/app_data.rs +++ b/tests/app_data.rs @@ -12,35 +12,17 @@ use wireframe::extractor::{ SharedState, }; -#[expect( - clippy::allow_attributes, - reason = "rstest single-line fixtures need allow to avoid unfulfilled lint expectations" -)] -#[allow( - unfulfilled_lint_expectations, - reason = "rstest occasionally misses the expected lint for single-line fixtures on stable" -)] -#[expect( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] #[fixture] -fn request() -> MessageRequest { MessageRequest::default() } +fn request() -> MessageRequest { + // Default request for extractor tests + MessageRequest::default() +} -#[expect( - clippy::allow_attributes, - reason = "rstest single-line fixtures need allow to avoid unfulfilled lint expectations" -)] -#[allow( - unfulfilled_lint_expectations, - reason = "rstest occasionally misses the expected lint for single-line fixtures on stable" -)] -#[expect( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] #[fixture] -fn empty_payload() -> Payload<'static> { Payload::default() } +fn empty_payload() -> Payload<'static> { + // Empty payload for extractor tests + Payload::default() +} #[rstest] fn shared_state_extractor_returns_data( diff --git a/tests/connection_actor_errors.rs b/tests/connection_actor_errors.rs index b9c44393..2a605398 100644 --- a/tests/connection_actor_errors.rs +++ b/tests/connection_actor_errors.rs @@ -25,41 +25,21 @@ use wireframe_testing::{LoggerHandle, logger, push_expect}; mod common; use common::TestResult; -#[expect( - clippy::allow_attributes, - reason = "rstest single-line fixtures need allow to avoid unfulfilled lint expectations" -)] -#[allow( - unfulfilled_lint_expectations, - reason = "rstest occasionally misses the expected lint for single-line fixtures on stable" -)] -#[expect( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] #[fixture] fn queues() -> Result<(PushQueues, wireframe::push::PushHandle), wireframe::push::PushConfigError> { + // Push queues with default capacities for error propagation tests PushQueues::::builder() .high_capacity(8) .low_capacity(8) .build() } -#[expect( - clippy::allow_attributes, - reason = "rstest single-line fixtures need allow to avoid unfulfilled lint expectations" -)] -#[allow( - unfulfilled_lint_expectations, - reason = "rstest occasionally misses the expected lint for single-line fixtures on stable" -)] -#[expect( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] #[fixture] -fn shutdown_token() -> CancellationToken { CancellationToken::new() } +fn shutdown_token() -> CancellationToken { + // Shutdown token for connection actor tests + CancellationToken::new() +} #[rstest] #[tokio::test] diff --git a/tests/connection_actor_shutdown.rs b/tests/connection_actor_shutdown.rs index 80bde3d2..d117cd33 100644 --- a/tests/connection_actor_shutdown.rs +++ b/tests/connection_actor_shutdown.rs @@ -12,42 +12,20 @@ use wireframe_testing::push_expect; mod common; use common::TestResult; -// Apply expected lint suppressions for single-line rstest fixtures. -// Context: https://github.com/la10736/rstest/issues/222 -macro_rules! single_line_fixture { - ($item:item) => { - #[expect( - clippy::allow_attributes, - reason = "rstest single-line fixtures need allow to avoid unfulfilled lint \ - expectations" - )] - #[allow( - unfulfilled_lint_expectations, - reason = "rstest occasionally misses the expected lint for single-line fixtures on \ - stable" - )] - #[expect( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" - )] - $item - }; -} - -single_line_fixture! { - #[fixture] - fn queues() - -> Result<(PushQueues, wireframe::push::PushHandle), wireframe::push::PushConfigError> { - PushQueues::::builder() - .high_capacity(8) - .low_capacity(8) - .build() - } +#[fixture] +fn queues() +-> Result<(PushQueues, wireframe::push::PushHandle), wireframe::push::PushConfigError> { + // Push queues with default capacities for shutdown tests + PushQueues::::builder() + .high_capacity(8) + .low_capacity(8) + .build() } -single_line_fixture! { - #[fixture] - fn shutdown_token() -> CancellationToken { CancellationToken::new() } +#[fixture] +fn shutdown_token() -> CancellationToken { + // Shutdown token for connection actor tests + CancellationToken::new() } #[rstest] diff --git a/tests/push_policies.rs b/tests/push_policies.rs index cdc6d548..90ca3c5e 100644 --- a/tests/push_policies.rs +++ b/tests/push_policies.rs @@ -15,20 +15,11 @@ use wireframe_testing::{LoggerHandle, logger}; mod common; use common::TestResult; -#[expect( - clippy::allow_attributes, - reason = "rstest single-line fixtures need allow to avoid unfulfilled lint expectations" -)] -#[allow( - unfulfilled_lint_expectations, - reason = "rstest occasionally misses the expected lint for single-line fixtures on stable" -)] -#[expect( - unused_braces, - reason = "rustc false positive for single-line rstest fixtures" -)] #[fixture] -fn builder() -> PushQueuesBuilder { support::builder::() } +fn builder() -> PushQueuesBuilder { + // PushQueuesBuilder for push queue policy tests + support::builder::() +} #[derive(Clone, Copy)] struct PolicyCase { diff --git a/wireframe_testing/src/logging.rs b/wireframe_testing/src/logging.rs index a98205c0..ac729769 100644 --- a/wireframe_testing/src/logging.rs +++ b/wireframe_testing/src/logging.rs @@ -74,9 +74,8 @@ impl std::ops::DerefMut for LoggerHandle { } /// rstest fixture returning a [`LoggerHandle`] for log assertions. -#[allow( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] #[fixture] -pub fn logger() -> LoggerHandle { LoggerHandle::new() } +pub fn logger() -> LoggerHandle { + // Acquire exclusive access to the global logger for test assertions + LoggerHandle::new() +} diff --git a/wireframe_testing/src/multi_packet.rs b/wireframe_testing/src/multi_packet.rs index 39fe88fd..7eabfd72 100644 --- a/wireframe_testing/src/multi_packet.rs +++ b/wireframe_testing/src/multi_packet.rs @@ -28,7 +28,11 @@ use wireframe::Response; /// the received variant and is attributed to the caller. #[must_use] #[track_caller] -#[allow(ungated_async_fn_track_caller)] // track_caller on async is unstable +// FIXME(#333): Remove when `track_caller` on async fns is stabilised. +#[expect( + ungated_async_fn_track_caller, + reason = "track_caller on async fns is unstable" +)] pub async fn collect_multi_packet(resp: Response) -> Vec { match resp { Response::MultiPacket(mut rx) => { From 8c316505688f60e2114754482dccfc079a1bd2be Mon Sep 17 00:00:00 2001 From: Leynos Date: Mon, 2 Feb 2026 13:54:13 +0000 Subject: [PATCH 2/3] chore(tests): clarify comments and update FIXME formatting - Updated comments in tests/app_data.rs to specify shared state extraction context - Added tracking URL and adjusted FIXME comment in wireframe_testing/src/multi_packet.rs for async track_caller issue Co-authored-by: devboxerhub[bot] --- tests/app_data.rs | 4 ++-- wireframe_testing/src/multi_packet.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/app_data.rs b/tests/app_data.rs index e24143af..6601c615 100644 --- a/tests/app_data.rs +++ b/tests/app_data.rs @@ -14,13 +14,13 @@ use wireframe::extractor::{ #[fixture] fn request() -> MessageRequest { - // Default request for extractor tests + // Default request for shared state extraction tests MessageRequest::default() } #[fixture] fn empty_payload() -> Payload<'static> { - // Empty payload for extractor tests + // Empty payload for shared state extraction tests Payload::default() } diff --git a/wireframe_testing/src/multi_packet.rs b/wireframe_testing/src/multi_packet.rs index 7eabfd72..992eb3fc 100644 --- a/wireframe_testing/src/multi_packet.rs +++ b/wireframe_testing/src/multi_packet.rs @@ -28,7 +28,8 @@ use wireframe::Response; /// the received variant and is attributed to the caller. #[must_use] #[track_caller] -// FIXME(#333): Remove when `track_caller` on async fns is stabilised. +// FIXME: Remove when `track_caller` on async fns is stabilised. +// Tracking: https://github.com/rust-lang/rust/issues/110011 #[expect( ungated_async_fn_track_caller, reason = "track_caller on async fns is unstable" From 692bc6faacd038ae48e92a038bb07a6554214d19 Mon Sep 17 00:00:00 2001 From: Leynos Date: Tue, 3 Feb 2026 12:55:48 +0000 Subject: [PATCH 3/3] docs(multi_packet): correct spelling of 'stabilised' to 'stabilized' in comment Co-authored-by: devboxerhub[bot] --- wireframe_testing/src/multi_packet.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wireframe_testing/src/multi_packet.rs b/wireframe_testing/src/multi_packet.rs index 992eb3fc..8a00f1e0 100644 --- a/wireframe_testing/src/multi_packet.rs +++ b/wireframe_testing/src/multi_packet.rs @@ -28,7 +28,7 @@ use wireframe::Response; /// the received variant and is attributed to the caller. #[must_use] #[track_caller] -// FIXME: Remove when `track_caller` on async fns is stabilised. +// FIXME: Remove when `track_caller` on async fns is stabilized. // Tracking: https://github.com/rust-lang/rust/issues/110011 #[expect( ungated_async_fn_track_caller,