Fix many clippy lints
This commit is contained in:
+4
-6
@@ -74,9 +74,8 @@ impl InnerRwLock {
|
||||
waiting_wr = expected & WAITING_WR;
|
||||
|
||||
if actual & COUNT_MASK > 0 {
|
||||
match 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
|
||||
@@ -94,9 +93,8 @@ impl InnerRwLock {
|
||||
pub fn acquire_read_lock(&self, deadline: Option<(×pec, clockid_t)>) -> Result<(), Errno> {
|
||||
let relative = Self::translate_timeout(deadline)?;
|
||||
while let Err(old) = self.try_acquire_read_lock() {
|
||||
match 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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,17 +35,14 @@ impl Semaphore {
|
||||
return 0;
|
||||
}
|
||||
|
||||
match self.count.compare_exchange_weak(
|
||||
if self.count.compare_exchange_weak(
|
||||
value,
|
||||
value - 1,
|
||||
Ordering::SeqCst,
|
||||
Ordering::SeqCst,
|
||||
) {
|
||||
Ok(_) => {
|
||||
// Acquired
|
||||
return value;
|
||||
}
|
||||
Err(_) => (),
|
||||
).is_ok() {
|
||||
// Acquired
|
||||
return value;
|
||||
}
|
||||
// Try again (as long as value > 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user