From: Elias Rohrer Date: Fri, 13 May 2022 16:03:51 +0000 (+0200) Subject: Fix unused code warnings. X-Git-Tag: v0.0.107~30^2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=79f42d72e2a93ab39b57794942a90d9f143a1d8f;p=rust-lightning Fix unused code warnings. --- diff --git a/lightning/src/util/fairrwlock.rs b/lightning/src/util/fairrwlock.rs index 8dd74f2b5..c9b3866be 100644 --- a/lightning/src/util/fairrwlock.rs +++ b/lightning/src/util/fairrwlock.rs @@ -1,4 +1,4 @@ -use std::sync::{TryLockResult, LockResult, RwLock, RwLockReadGuard, RwLockWriteGuard}; +use std::sync::{LockResult, RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::sync::atomic::{AtomicUsize, Ordering}; /// Rust libstd's RwLock does not provide any fairness guarantees (and, in fact, when used on @@ -32,10 +32,6 @@ impl FairRwLock { res } - pub fn try_write(&self) -> TryLockResult> { - self.lock.try_write() - } - pub fn read(&self) -> LockResult> { if self.waiting_writers.load(Ordering::Relaxed) != 0 { let _write_queue_lock = self.lock.write(); diff --git a/lightning/src/util/mod.rs b/lightning/src/util/mod.rs index 075798331..b7ee02d2c 100644 --- a/lightning/src/util/mod.rs +++ b/lightning/src/util/mod.rs @@ -25,7 +25,7 @@ pub mod persist; pub(crate) mod atomic_counter; pub(crate) mod byte_utils; pub(crate) mod chacha20; -#[cfg(feature = "std")] +#[cfg(all(not(test), feature = "std"))] pub(crate) mod fairrwlock; #[cfg(fuzzing)] pub mod zbase32; diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index b5953834c..5e9591d8e 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -267,12 +267,12 @@ impl TestChannelMessageHandler { expected_msgs.as_mut().unwrap().push(ev); } - fn received_msg(&self, ev: wire::Message<()>) { + fn received_msg(&self, _ev: wire::Message<()>) { let mut msgs = self.expected_recv_msgs.lock().unwrap(); if msgs.is_none() { return; } assert!(!msgs.as_ref().unwrap().is_empty(), "Received message when we weren't expecting one"); #[cfg(test)] - assert_eq!(msgs.as_ref().unwrap()[0], ev); + assert_eq!(msgs.as_ref().unwrap()[0], _ev); msgs.as_mut().unwrap().remove(0); } }