From fc8d7ee7c21ec70c559796a02d33640f98d68502 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Mon, 4 Jul 2022 21:42:00 +0800 Subject: [PATCH] Support notification on eviction Fix "unused field" warnings in `notification::notifier` module. --- src/notification/notifier.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/notification/notifier.rs b/src/notification/notifier.rs index 079a6f54..884ec247 100644 --- a/src/notification/notifier.rs +++ b/src/notification/notifier.rs @@ -89,15 +89,17 @@ impl RemovalNotifier { pub(crate) struct BlockingRemovalNotifier { listener: EvictionListener, is_enabled: AtomicBool, + #[cfg(feature = "logging")] cache_name: Option, } impl BlockingRemovalNotifier { - fn new(listener: EvictionListener, cache_name: Option) -> Self { + fn new(listener: EvictionListener, _cache_name: Option) -> Self { Self { listener, is_enabled: AtomicBool::new(true), - cache_name, + #[cfg(feature = "logging")] + cache_name: _cache_name, } } @@ -147,14 +149,15 @@ impl Drop for ThreadPoolRemovalNotifier { } impl ThreadPoolRemovalNotifier { - fn new(listener: EvictionListener, cache_name: Option) -> Self { + fn new(listener: EvictionListener, _cache_name: Option) -> Self { let (snd, rcv) = crossbeam_channel::bounded(CHANNEL_CAPACITY); let thread_pool = ThreadPoolRegistry::acquire_pool(PoolName::RemovalNotifier); let state = NotifierState { task_lock: Default::default(), rcv, listener, - cache_name, + #[cfg(feature = "logging")] + cache_name: _cache_name, is_enabled: AtomicBool::new(true), is_running: Default::default(), is_shutting_down: Default::default(), @@ -314,6 +317,7 @@ struct NotifierState { task_lock: Mutex<()>, rcv: Receiver>, listener: EvictionListener, + #[cfg(feature = "logging")] cache_name: Option, is_enabled: AtomicBool, is_running: AtomicBool,