From dab567941cdc89d285b9929c675208fbe1949ae0 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Mon, 26 Oct 2026 11:13:51 +0000 Subject: [PATCH] fix: gate WhatsApp helpers used only by the Web adapter Avoids dead-code warnings when whatsapp-web is off. Co-authored-by: Medulla --- src/providers/whatsapp_shared/error.rs | 5 +++++ src/providers/whatsapp_shared/window.rs | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/providers/whatsapp_shared/error.rs b/src/providers/whatsapp_shared/error.rs index 4b1fb028c..58feecdab 100644 --- a/src/providers/whatsapp_shared/error.rs +++ b/src/providers/whatsapp_shared/error.rs @@ -11,6 +11,10 @@ pub(crate) enum WaFailure { /// Refused before any provider call: bad scope, missing port, invalid input. Rejected(String), /// The input cannot be represented by this provider's address format. + /// + /// Only the Web adapter builds this class; the Cloud API adapter just + /// handles it. + #[cfg_attr(not(any(test, feature = "whatsapp-web")), allow(dead_code))] BadFormat(String), /// The adapter or protocol cannot carry this content or operation. Unsupported(String), @@ -35,6 +39,7 @@ impl WaFailure { Self::Rejected(message.into()) } + #[cfg(any(test, feature = "whatsapp-web"))] pub(crate) fn bad_format(message: impl Into) -> Self { Self::BadFormat(message.into()) } diff --git a/src/providers/whatsapp_shared/window.rs b/src/providers/whatsapp_shared/window.rs index 7e1fa8674..ad5097946 100644 --- a/src/providers/whatsapp_shared/window.rs +++ b/src/providers/whatsapp_shared/window.rs @@ -76,8 +76,10 @@ impl BoundedMap { /// aborted. A listener that parks keeps its inbound sender in such a slot; if /// the slot outlived the listener the module's inbound forwarder would never /// see its channel close and provider shutdown would wait forever. +#[cfg(any(test, feature = "whatsapp-web"))] pub(crate) struct ClearOnDrop<'a, T>(pub(crate) &'a parking_lot::Mutex>); +#[cfg(any(test, feature = "whatsapp-web"))] impl Drop for ClearOnDrop<'_, T> { fn drop(&mut self) { *self.0.lock() = None;