summaryrefslogtreecommitdiff
path: root/src/lock.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2022-10-27 18:41:23 -0400
committerBotahamec <botahamec@outlook.com>2022-10-27 18:41:23 -0400
commitc55152017ea3365172b82738291a5e02df0f13ef (patch)
treebd7ed45dff8ce577de1fcfb74e7f9c9520ddb30c /src/lock.rs
parent7b0675a1e42341030bbb9ad98d41a321296e1ecc (diff)
Added cargo warnings
Diffstat (limited to 'src/lock.rs')
-rw-r--r--src/lock.rs7
1 files changed, 4 insertions, 3 deletions
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);
}
}