From c31861aa6570ec2da59d32c60d75e3117f537acd Mon Sep 17 00:00:00 2001 From: k-nasa Date: Tue, 1 Oct 2019 17:43:47 +0900 Subject: [PATCH] rafactor if expression --- src/task/sleepers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/task/sleepers.rs b/src/task/sleepers.rs index a907175..b5902fb 100644 --- a/src/task/sleepers.rs +++ b/src/task/sleepers.rs @@ -30,7 +30,7 @@ impl Sleepers { pub fn wait(&self) { let mut sleep = self.sleep.lock().unwrap(); - if self.notified.swap(false, Ordering::SeqCst) == false { + if !self.notified.swap(false, Ordering::SeqCst){ *sleep += 1; let _ = self.wake.wait(sleep).unwrap(); } @@ -38,7 +38,7 @@ impl Sleepers { /// Notifies one thread. pub fn notify_one(&self) { - if self.notified.load(Ordering::SeqCst) == false { + if !self.notified.load(Ordering::SeqCst) { let mut sleep = self.sleep.lock().unwrap(); if *sleep > 0 {