Drop unused `sync` module from `lightning-invoice`
authorElias Rohrer <dev@tnull.de>
Sat, 16 Dec 2023 12:39:22 +0000 (13:39 +0100)
committerElias Rohrer <dev@tnull.de>
Mon, 18 Dec 2023 07:53:27 +0000 (08:53 +0100)
lightning-invoice/src/lib.rs
lightning-invoice/src/sync.rs [deleted file]

index 690bf57640862daae0adb55019ab48d90a2384a0..59622a84abea9dcae4b5cb3504a0e2aa8fcb18ef 100644 (file)
@@ -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 (file)
index fae923f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-use core::cell::{RefCell, RefMut};
-use core::ops::{Deref, DerefMut};
-
-pub type LockResult<Guard> = Result<Guard, ()>;
-
-pub struct Mutex<T: ?Sized> {
-       inner: RefCell<T>
-}
-
-#[must_use = "if unused the Mutex will immediately unlock"]
-pub struct MutexGuard<'a, T: ?Sized + 'a> {
-       lock: RefMut<'a, T>,
-}
-
-impl<T: ?Sized> Deref for MutexGuard<'_, T> {
-       type Target = T;
-
-       fn deref(&self) -> &T {
-               &self.lock.deref()
-       }
-}
-
-impl<T: ?Sized> DerefMut for MutexGuard<'_, T> {
-       fn deref_mut(&mut self) -> &mut T {
-               self.lock.deref_mut()
-       }
-}
-
-impl<T> Mutex<T> {
-       pub fn new(inner: T) -> Mutex<T> {
-               Mutex { inner: RefCell::new(inner) }
-       }
-
-       pub fn lock<'a>(&'a self) -> LockResult<MutexGuard<'a, T>> {
-               Ok(MutexGuard { lock: self.inner.borrow_mut() })
-       }
-}