From: Elias Rohrer Date: Sat, 16 Dec 2023 12:39:22 +0000 (+0100) Subject: Drop unused `sync` module from `lightning-invoice` X-Git-Tag: v0.0.120~20^2~6 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=d8eababd8b016c32219a5208235c59a3663adf75;p=rust-lightning Drop unused `sync` module from `lightning-invoice` --- 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() }) - } -}