From 0f7f61613308762c967ebf76928ba83ceaa35114 Mon Sep 17 00:00:00 2001 From: cheatfate Date: Wed, 30 May 2018 07:55:35 +0300 Subject: [PATCH] Removed unnecessary checks. --- asyncdispatch2/asyncfutures2.nim | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/asyncdispatch2/asyncfutures2.nim b/asyncdispatch2/asyncfutures2.nim index 0d476fdb..199d11b2 100644 --- a/asyncdispatch2/asyncfutures2.nim +++ b/asyncdispatch2/asyncfutures2.nim @@ -188,12 +188,11 @@ proc fail*[T](future: Future[T], error: ref Exception) = future.callbacks.call() proc clearCallbacks(future: FutureBase) = - if len(future.callbacks) > 0: - # ZAH: This could have been a single call to `setLen` - var count = len(future.callbacks) - while count > 0: - discard future.callbacks.popFirst() - dec(count) + # ZAH: This could have been a single call to `setLen` + var count = len(future.callbacks) + while count > 0: + discard future.callbacks.popFirst() + dec(count) proc addCallback*(future: FutureBase, cb: CallbackFunc, udata: pointer = nil) = ## Adds the callbacks proc to be called when the future completes.