Skip to content

Commit c6854dd

Browse files
authored
Fix assert, remove unused attrs (#18)
1 parent 5898d7f commit c6854dd

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

source/mutex-traits/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ pub unsafe trait RawMutex {
126126
}
127127

128128
unsafe impl<M: RawMutex> ScopedRawMutex for M {
129-
#[must_use]
130129
#[inline]
131130
#[track_caller]
132131
fn try_with_lock<R>(&self, f: impl FnOnce() -> R) -> Option<R> {

source/mutex/src/raw_impls.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ pub mod cs {
109109

110110
unsafe impl ScopedRawMutex for CriticalSectionRawMutex {
111111
#[inline]
112-
#[must_use]
113112
fn try_with_lock<R>(&self, f: impl FnOnce() -> R) -> Option<R> {
114113
critical_section::with(|_| {
115114
// NOTE: separated load/stores are acceptable as we are in
@@ -173,7 +172,6 @@ pub mod local {
173172

174173
unsafe impl ScopedRawMutex for LocalRawMutex {
175174
#[inline]
176-
#[must_use]
177175
fn try_with_lock<R>(&self, f: impl FnOnce() -> R) -> Option<R> {
178176
// NOTE: separated load/stores are acceptable as we are !Sync,
179177
// meaning that we can only be accessed within a single thread
@@ -245,7 +243,7 @@ pub mod single_core_thread_mode {
245243
}
246244
// NOTE: separated load/stores are acceptable as we checked we are only
247245
// accessed from a single thread (checked above)
248-
assert!(self.taken.load(Ordering::Relaxed));
246+
assert!(!self.taken.load(Ordering::Relaxed));
249247
self.taken.store(true, Ordering::Relaxed);
250248
let ret = f();
251249
self.taken.store(false, Ordering::Relaxed);

0 commit comments

Comments
 (0)