From aada858a03a571017512c0be0ed4d9507c98cc84 Mon Sep 17 00:00:00 2001 From: Fina Wilke Date: Sat, 9 Dec 2023 22:00:50 +0100 Subject: [PATCH] code: Allow dead_code for methods only used in features --- src/core.rs | 1 + src/core/key.rs | 2 ++ src/lib.rs | 1 + src/util.rs | 4 ++++ 4 files changed, 8 insertions(+) diff --git a/src/core.rs b/src/core.rs index 174d109c..98e04816 100644 --- a/src/core.rs +++ b/src/core.rs @@ -495,6 +495,7 @@ pub enum Mood { Unwelcome, } +#[allow(dead_code)] pub const APPID_RAW: &str = "lothar.com/wormhole/text-or-file-xfer"; /** diff --git a/src/core/key.rs b/src/core/key.rs index cc52fdac..36730872 100644 --- a/src/core/key.rs +++ b/src/core/key.rs @@ -135,6 +135,7 @@ impl VersionsMessage { self.app_versions = versions; } + #[cfg(feature = "dilation")] pub fn enable_dilation(&mut self) { self.can_dilate = Some([std::borrow::Cow::Borrowed("1")]) } @@ -378,6 +379,7 @@ mod test { // } #[test] + #[cfg(dilation)] fn test_versions_message_can_dilate() { let mut message = VersionsMessage::new(); diff --git a/src/lib.rs b/src/lib.rs index 3be0651c..969731a0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,6 +22,7 @@ #![forbid(unsafe_code)] #![allow(clippy::upper_case_acronyms)] #![allow(clippy::too_many_arguments)] +#![allow(unused_macros)] #[macro_use] mod util; diff --git a/src/util.rs b/src/util.rs index 1bec0a2e..96173fa5 100644 --- a/src/util.rs +++ b/src/util.rs @@ -176,17 +176,20 @@ pub fn hashcash(resource: String, bits: u32) -> String { } } #[cfg(not(target_family = "wasm"))] +#[allow(dead_code)] pub async fn sleep(duration: std::time::Duration) { async_std::task::sleep(duration).await } #[cfg(target_family = "wasm")] +#[allow(dead_code)] pub async fn sleep(duration: std::time::Duration) { /* Skip error handling. Waiting is best effort anyways */ let _ = wasm_timer::Delay::new(duration).await; } #[cfg(not(target_family = "wasm"))] +#[allow(dead_code)] pub async fn timeout( duration: std::time::Duration, future: F, @@ -198,6 +201,7 @@ where } #[cfg(target_family = "wasm")] +#[allow(dead_code)] pub async fn timeout(duration: std::time::Duration, future: F) -> Result where F: futures::Future,