status-im / nim-chronos

Chronos - An efficient library for asynchronous programming
https://status-im.github.io/nim-chronos/docs/chronos
Apache License 2.0
353 stars 51 forks source link

Implicit returns generates warnings #414

Closed cheatfate closed 1 year ago

cheatfate commented 1 year ago
import chronos
proc testFoo1(): Future[int] {.async.} =
  result = 3
proc testFoo2(): Future[int] {.async.} =
  return 3
proc testFoo3(): Future[int] {.async.} =
  3
when isMainModule:
  echo waitFor(testFoo3())

This program generates compilation warning

nim-chronos\chronos\asyncmacro2.nim(180, 44) Hint: 'result' is declared but not used [XDeclaredButNotUsed]

testFoo1() and testFoo2() do not generate warnings.

Related PR https://github.com/status-im/nim-chronos/pull/401

cc @arnetheduck

arnetheduck commented 1 year ago

417