From a09fd9742d4abe00c29f500a3ce61186e7ba46f0 Mon Sep 17 00:00:00 2001 From: Bhuwan Pandit Date: Tue, 10 Dec 2024 19:47:18 +0000 Subject: [PATCH] chore: fix dead code warning for 'Sealed' trait and 'sample_floyd2' func (#799) --- tower/src/lib.rs | 1 + tower/src/util/rng.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/tower/src/lib.rs b/tower/src/lib.rs index 179edfbec..ce911e9d8 100644 --- a/tower/src/lib.rs +++ b/tower/src/lib.rs @@ -219,6 +219,7 @@ pub use tower_layer::Layer; pub use tower_service::Service; #[allow(unreachable_pub)] +#[cfg(any(feature = "balance", feature = "discover", feature = "make"))] mod sealed { pub trait Sealed {} } diff --git a/tower/src/util/rng.rs b/tower/src/util/rng.rs index 9b6d307d9..5b2f9fce7 100644 --- a/tower/src/util/rng.rs +++ b/tower/src/util/rng.rs @@ -116,6 +116,7 @@ where /// /// ref: This was borrowed and modified from the following Rand implementation /// https://github.com/rust-random/rand/blob/b73640705d6714509f8ceccc49e8df996fa19f51/src/seq/index.rs#L375-L411 +#[cfg(feature = "balance")] pub(crate) fn sample_floyd2(rng: &mut R, length: u64) -> [u64; 2] { debug_assert!(2 <= length); let aidx = rng.next_range(0..length - 1);