Fix "unused variable" warnings

This commit is contained in:
Mark Spanbroek 2021-07-07 09:19:44 +02:00
parent 4a1783c472
commit 8feb684574

View File

@ -7,12 +7,12 @@ proc option[T](option: Option[T]): Option[T] =
template bindLet(name, expression): bool = template bindLet(name, expression): bool =
let option = expression.option let option = expression.option
const default = typeof(option.unsafeGet()).default const default = typeof(option.unsafeGet()).default
let name = if option.isSome: option.unsafeGet() else: default let name {.used.} = if option.isSome: option.unsafeGet() else: default
option.isSome option.isSome
template bindVar(name, expression): bool = template bindVar(name, expression): bool =
let option = expression.option let option = expression.option
var name : typeof(option.unsafeGet()) var name {.used.} : typeof(option.unsafeGet())
if option.isSome: if option.isSome:
name = option.unsafeGet() name = option.unsafeGet()
option.isSome option.isSome