From f46803b225afed53488ef69f84d8775fe8b3fbd3 Mon Sep 17 00:00:00 2001 From: hlaaftana <10591326+hlaaftana@users.noreply.github.com> Date: Sat, 18 Apr 2020 18:41:03 +0300 Subject: [PATCH] Fix unused warning for `$` for empty tuple/objects (#13991) --- lib/system/dollars.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/system/dollars.nim b/lib/system/dollars.nim index 664f1c30d..3414c6db1 100644 --- a/lib/system/dollars.nim +++ b/lib/system/dollars.nim @@ -75,7 +75,8 @@ proc `$`*[T: tuple|object](x: T): string = ## $(a: 23, b: 45) == "(a: 23, b: 45)" ## $() == "()" result = "(" - var firstElement = true + # when x is empty, this gives an unused warning + var firstElement {.used.} = true const isNamed = T is object or isNamedTuple(T) when not isNamed: var count = 0