From c55152017ea3365172b82738291a5e02df0f13ef Mon Sep 17 00:00:00 2001 From: Botahamec Date: Thu, 27 Oct 2022 18:41:23 -0400 Subject: Added cargo warnings --- src/lock.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/lock.rs') diff --git a/src/lock.rs b/src/lock.rs index fb74f25..5a6315d 100644 --- a/src/lock.rs +++ b/src/lock.rs @@ -12,7 +12,7 @@ pub struct Key<'a> { } impl<'a> Key<'a> { - fn new(lock: &'a Lock) -> Self { + const fn new(lock: &'a Lock) -> Self { Self { lock } } } @@ -26,6 +26,7 @@ impl<'a> Drop for Key<'a> { impl Lock { /// Create a new unlocked `Lock`. + #[must_use] pub const fn new() -> Self { Self { is_locked: AtomicBool::new(false), @@ -52,10 +53,10 @@ impl Lock { /// means the program no longer has a reference to the key, but it has not /// been dropped. unsafe fn force_unlock(&self) { - self.is_locked.store(false, Ordering::Release) + self.is_locked.store(false, Ordering::Release); } pub fn unlock(key: Key) { - drop(key) + drop(key); } } -- cgit v1.2.3