Fix unused code warnings.

This commit is contained in:
Elias Rohrer 2022-05-13 18:03:51 +02:00
parent b5a63070f5
commit 79f42d72e2
3 changed files with 4 additions and 8 deletions

View 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();

View 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;

View 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);
}
}