From f09c9e437eef8ed5304de05430368bb9354ab9aa Mon Sep 17 00:00:00 2001 From: Juan Aguilar Date: Sun, 29 Nov 2020 04:31:31 +0100 Subject: [PATCH] Simplify task LocalWaker register method (#30) --- ntex/src/task.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ntex/src/task.rs b/ntex/src/task.rs index d34415011..3c99a9f4b 100644 --- a/ntex/src/task.rs +++ b/ntex/src/task.rs @@ -46,12 +46,7 @@ impl LocalWaker { /// /// Returns `true` if waker was registered before. pub fn register(&self, waker: &Waker) -> bool { - unsafe { - let w = self.waker.get(); - let is_registered = (*w).is_some(); - *w = Some(waker.clone()); - is_registered - } + unsafe { self.waker.get().replace(Some(waker.clone())).is_some() } } #[inline]