From 83af9888f584f354a5318812e9c90f3f3f210f19 Mon Sep 17 00:00:00 2001 From: Константин Молчанов Date: Thu, 2 Jun 2016 17:20:46 +0300 Subject: stdlib: asyncdispatch: `all`: Redundant closure removed. --- lib/pure/asyncdispatch.nim | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index 624836358..7cf1a36e3 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -369,15 +369,12 @@ proc all*[T](futs: varargs[Future[T]]): auto = let totalFutures = len(futs) - for i, fut in futs: - proc setCallback(i: int) = - fut.callback = proc(f: Future[T]) = - inc(completedFutures) + for fut in futs: + fut.callback = proc(f: Future[T]) = + inc(completedFutures) - if completedFutures == totalFutures: - retFuture.complete() - - setCallback(i) + if completedFutures == totalFutures: + retFuture.complete() return retFuture -- cgit 1.4.1-2-gfad0