From 9ba418cd3be9593b967bf74d2110fa71640806fa Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Sun, 30 Apr 2023 20:09:36 +0300 Subject: [PATCH] Eliminate warnings on Windows. (#382) --- chronos/asyncfutures2.nim | 2 +- tests/testbugs.nim | 6 +++--- tests/testhttpclient.nim | 2 +- tests/testhttpserver.nim | 2 +- tests/testshttpserver.nim | 2 +- tests/teststream.nim | 5 +++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/chronos/asyncfutures2.nim b/chronos/asyncfutures2.nim index bac4ba1..546aecb 100644 --- a/chronos/asyncfutures2.nim +++ b/chronos/asyncfutures2.nim @@ -10,7 +10,7 @@ import std/sequtils import stew/base10 -import "."/[config, srcloc] +import "."/srcloc export srcloc when defined(nimHasStacktracesModule): diff --git a/tests/testbugs.nim b/tests/testbugs.nim index 19a8edb..ba1e6df 100644 --- a/tests/testbugs.nim +++ b/tests/testbugs.nim @@ -117,14 +117,14 @@ suite "Asynchronous issues test suite": let inpTransp = await afut let bytesSent = await outTransp.write(msg) check bytesSent == messageSize - var rfut = inpTransp.readExactly(addr buffer[0], messageSize) + var rfut {.used.} = inpTransp.readExactly(addr buffer[0], messageSize) proc waiterProc(udata: pointer) {.raises: [Defect], gcsafe.} = try: waitFor(sleepAsync(0.milliseconds)) - except CatchableError as exc: + except CatchableError: raiseAssert "Unexpected exception happened" - let timer = setTimer(Moment.fromNow(0.seconds), waiterProc, nil) + let timer {.used.} = setTimer(Moment.fromNow(0.seconds), waiterProc, nil) await sleepAsync(100.milliseconds) await inpTransp.closeWait() diff --git a/tests/testhttpclient.nim b/tests/testhttpclient.nim index e04e2ab..16d1dc7 100644 --- a/tests/testhttpclient.nim +++ b/tests/testhttpclient.nim @@ -5,7 +5,7 @@ # Licensed under either of # Apache License, version 2.0, (LICENSE-APACHEv2) # MIT license (LICENSE-MIT) -import std/[strutils, strutils, sha1] +import std/[strutils, sha1] import unittest2 import ../chronos, ../chronos/apps/http/[httpserver, shttpserver, httpclient] import stew/base10 diff --git a/tests/testhttpserver.nim b/tests/testhttpserver.nim index 8b71ca2..acf8b20 100644 --- a/tests/testhttpserver.nim +++ b/tests/testhttpserver.nim @@ -5,7 +5,7 @@ # Licensed under either of # Apache License, version 2.0, (LICENSE-APACHEv2) # MIT license (LICENSE-MIT) -import std/[strutils, algorithm, strutils] +import std/[strutils, algorithm] import unittest2 import ../chronos, ../chronos/apps/http/httpserver, ../chronos/apps/http/httpcommon diff --git a/tests/testshttpserver.nim b/tests/testshttpserver.nim index 4b55b27..a258cc9 100644 --- a/tests/testshttpserver.nim +++ b/tests/testshttpserver.nim @@ -5,7 +5,7 @@ # Licensed under either of # Apache License, version 2.0, (LICENSE-APACHEv2) # MIT license (LICENSE-MIT) -import std/[strutils, strutils] +import std/strutils import unittest2 import ../chronos, ../chronos/apps/http/shttpserver import stew/base10 diff --git a/tests/teststream.nim b/tests/teststream.nim index ea1de43..416e0a9 100644 --- a/tests/teststream.nim +++ b/tests/teststream.nim @@ -1286,10 +1286,11 @@ suite "Stream Transport test suite": var transp3 = await connect(dst2, localAddress = dst3, flags={SocketFlags.ReusePort}) expect(TransportOsError): - var transp2 = await connect(dst3, localAddress = ta) + var transp2 {.used.} = await connect(dst3, localAddress = ta) expect(TransportOsError): - var transp3 = await connect(dst3, localAddress = initTAddress(":::35000")) + var transp3 {.used.} = + await connect(dst3, localAddress = initTAddress(":::35000")) await transp1.closeWait() await transp2.closeWait()