Cargo fmt

This commit is contained in:
Speedy_Lex
2026-05-06 23:54:36 +02:00
parent eff610eac6
commit 2d4ab41de5
7 changed files with 29 additions and 21 deletions
+8 -4
View File
@@ -74,8 +74,10 @@ impl InnerRwLock {
waiting_wr = expected & WAITING_WR;
if actual & COUNT_MASK > 0 {
if crate::sync::futex_wait(&self.state, expected, relative.as_ref()) == super::FutexWaitResult::TimedOut {
return Err(Errno(ETIMEDOUT))
if crate::sync::futex_wait(&self.state, expected, relative.as_ref())
== super::FutexWaitResult::TimedOut
{
return Err(Errno(ETIMEDOUT));
}
} else {
// We must avoid blocking indefinitely in our `futex_wait()`, in this case
@@ -93,8 +95,10 @@ impl InnerRwLock {
pub fn acquire_read_lock(&self, deadline: Option<(&timespec, clockid_t)>) -> Result<(), Errno> {
let relative = Self::translate_timeout(deadline)?;
while let Err(old) = self.try_acquire_read_lock() {
if crate::sync::futex_wait(&self.state, old, relative.as_ref()) == super::FutexWaitResult::TimedOut {
return Err(Errno(ETIMEDOUT))
if crate::sync::futex_wait(&self.state, old, relative.as_ref())
== super::FutexWaitResult::TimedOut
{
return Err(Errno(ETIMEDOUT));
}
}
+5 -6
View File
@@ -35,12 +35,11 @@ impl Semaphore {
return 0;
}
if self.count.compare_exchange_weak(
value,
value - 1,
Ordering::SeqCst,
Ordering::SeqCst,
).is_ok() {
if self
.count
.compare_exchange_weak(value, value - 1, Ordering::SeqCst, Ordering::SeqCst)
.is_ok()
{
// Acquired
return value;
}