2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-04-01 22:16:40 +00:00

rafactor if expression

This commit is contained in:
k-nasa 2019-10-01 17:43:47 +09:00
parent f08fcd0bbb
commit c31861aa65

View file

@ -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 {