Skip to content

Commit 4b21877

Browse files
committed
lint code with rust 1.76
1 parent cec0cb9 commit 4b21877

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

lightning-invoice/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ mod prelude {
8383
#[cfg(feature = "hashbrown")]
8484
extern crate hashbrown;
8585

86-
pub use alloc::{vec, vec::Vec, string::String, collections::VecDeque, boxed::Box};
86+
pub use alloc::{vec, vec::Vec, string::String};
8787
#[cfg(not(feature = "hashbrown"))]
88-
pub use std::collections::{HashMap, HashSet, hash_map};
88+
pub use std::collections::{HashMap, hash_map};
8989
#[cfg(feature = "hashbrown")]
9090
pub use self::hashbrown::{HashMap, HashSet, hash_map};
9191

@@ -96,9 +96,7 @@ use crate::prelude::*;
9696

9797
/// Sync compat for std/no_std
9898
#[cfg(feature = "std")]
99-
mod sync {
100-
pub use ::std::sync::{Mutex, MutexGuard};
101-
}
99+
mod sync;
102100

103101
/// Sync compat for std/no_std
104102
#[cfg(not(feature = "std"))]

lightning-invoice/src/sync.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
use core::cell::{RefCell, RefMut};
1+
use core::cell::RefMut;
22
use core::ops::{Deref, DerefMut};
33

4-
pub type LockResult<Guard> = Result<Guard, ()>;
5-
6-
pub struct Mutex<T: ?Sized> {
7-
inner: RefCell<T>
8-
}
9-
104
#[must_use = "if unused the Mutex will immediately unlock"]
115
pub struct MutexGuard<'a, T: ?Sized + 'a> {
126
lock: RefMut<'a, T>,
@@ -25,13 +19,3 @@ impl<T: ?Sized> DerefMut for MutexGuard<'_, T> {
2519
self.lock.deref_mut()
2620
}
2721
}
28-
29-
impl<T> Mutex<T> {
30-
pub fn new(inner: T) -> Mutex<T> {
31-
Mutex { inner: RefCell::new(inner) }
32-
}
33-
34-
pub fn lock<'a>(&'a self) -> LockResult<MutexGuard<'a, T>> {
35-
Ok(MutexGuard { lock: self.inner.borrow_mut() })
36-
}
37-
}

0 commit comments

Comments
 (0)