From 5332124160e96afd77718e57168c7ec968823685 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 16 Dec 2025 18:23:11 +0000 Subject: [PATCH] test(lib): fix unused warnings due to feature gating test imports --- src/body/incoming.rs | 4 ++++ src/common/io/rewind.rs | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/body/incoming.rs b/src/body/incoming.rs index 64ee5001a9..8c7c6ff67e 100644 --- a/src/body/incoming.rs +++ b/src/body/incoming.rs @@ -458,12 +458,16 @@ impl fmt::Debug for Sender { #[cfg(test)] mod tests { + #[cfg(all(feature = "http1", any(feature = "client", feature = "server")))] use std::mem; + #[cfg(all(feature = "http1", any(feature = "client", feature = "server")))] use std::task::Poll; + #[cfg(all(feature = "http1", any(feature = "client", feature = "server")))] use super::{Body, Incoming, SizeHint}; #[cfg(all(feature = "http1", any(feature = "client", feature = "server")))] use super::{DecodedLength, Sender}; + #[cfg(all(feature = "http1", any(feature = "client", feature = "server")))] use http_body_util::BodyExt; #[cfg(all(feature = "http1", any(feature = "client", feature = "server")))] diff --git a/src/common/io/rewind.rs b/src/common/io/rewind.rs index c1f7a4f1b9..b692f438ee 100644 --- a/src/common/io/rewind.rs +++ b/src/common/io/rewind.rs @@ -14,7 +14,11 @@ pub(crate) struct Rewind { } impl Rewind { - #[cfg(test)] + #[cfg(all( + test, + any(feature = "client", feature = "server"), + any(feature = "http1", feature = "http2") + ))] pub(crate) fn new(io: T) -> Self { Rewind { pre: None, @@ -29,7 +33,11 @@ impl Rewind { } } - #[cfg(test)] + #[cfg(all( + test, + any(feature = "client", feature = "server"), + any(feature = "http1", feature = "http2") + ))] pub(crate) fn rewind(&mut self, bs: Bytes) { debug_assert!(self.pre.is_none()); self.pre = Some(bs);