From d8eababd8b016c32219a5208235c59a3663adf75 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Sat, 16 Dec 2023 13:39:22 +0100 Subject: [PATCH] Drop unused `sync` module from `lightning-invoice` --- lightning-invoice/src/lib.rs | 4 ---- lightning-invoice/src/sync.rs | 37 ----------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 lightning-invoice/src/sync.rs diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index 690bf5764..59622a84a 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -92,10 +92,6 @@ mod prelude { use crate::prelude::*; -/// Sync compat for std/no_std -#[cfg(not(feature = "std"))] -mod sync; - /// Errors that indicate what is wrong with the invoice. They have some granularity for debug /// reasons, but should generally result in an "invalid BOLT11 invoice" message for the user. #[allow(missing_docs)] diff --git a/lightning-invoice/src/sync.rs b/lightning-invoice/src/sync.rs deleted file mode 100644 index fae923feb..000000000 --- a/lightning-invoice/src/sync.rs +++ /dev/null @@ -1,37 +0,0 @@ -use core::cell::{RefCell, RefMut}; -use core::ops::{Deref, DerefMut}; - -pub type LockResult = Result; - -pub struct Mutex { - inner: RefCell -} - -#[must_use = "if unused the Mutex will immediately unlock"] -pub struct MutexGuard<'a, T: ?Sized + 'a> { - lock: RefMut<'a, T>, -} - -impl Deref for MutexGuard<'_, T> { - type Target = T; - - fn deref(&self) -> &T { - &self.lock.deref() - } -} - -impl DerefMut for MutexGuard<'_, T> { - fn deref_mut(&mut self) -> &mut T { - self.lock.deref_mut() - } -} - -impl Mutex { - pub fn new(inner: T) -> Mutex { - Mutex { inner: RefCell::new(inner) } - } - - pub fn lock<'a>(&'a self) -> LockResult> { - Ok(MutexGuard { lock: self.inner.borrow_mut() }) - } -} -- 2.39.5