]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Fix unused code warnings.
authorElias Rohrer <ero@tnull.de>
Fri, 13 May 2022 16:03:51 +0000 (18:03 +0200)
committerElias Rohrer <ero@tnull.de>
Fri, 13 May 2022 16:03:51 +0000 (18:03 +0200)
lightning/src/util/fairrwlock.rs
lightning/src/util/mod.rs
lightning/src/util/test_utils.rs

index 8dd74f2b53dc1697b5c8d4ad2e22eb231c84ba4e..c9b3866bec5c837e948b3a7f469515ed4b9b79f4 100644 (file)
@@ -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<T> FairRwLock<T> {
                res
        }
 
-       pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> {
-               self.lock.try_write()
-       }
-
        pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
                if self.waiting_writers.load(Ordering::Relaxed) != 0 {
                        let _write_queue_lock = self.lock.write();
index 0757983314e73f8698673e226a884c2752911547..b7ee02d2c1f5724ba0b0b6309ce2eb35ad321c1d 100644 (file)
@@ -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;
index b5953834c8cacbefd28dfc4c892bd7d700b8e94c..5e9591d8eba76652b4b2820959c0fd5e8cb5d67c 100644 (file)
@@ -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);
        }
 }