From 9d7e4b031a7935a21237d599d41a019429c56864 Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Sat, 9 Jul 2022 10:55:15 +0200 Subject: [PATCH] Clean-up of several compiler warnings (#519) --- eth/utp/growable_buffer.nim | 6 ++--- eth/utp/packets.nim | 3 +-- eth/utp/utp_discv5_protocol.nim | 2 +- eth/utp/utp_protocol.nim | 2 +- tests/p2p/test_routing_table.nim | 30 ++++++++++++------------- tests/trie/test_bin_trie.nim | 8 +++---- tests/utp/test_protocol_integration.nim | 3 +-- tests/utp/utp_packet_test_vectors.nim | 6 ++--- 8 files changed, 29 insertions(+), 31 deletions(-) diff --git a/eth/utp/growable_buffer.nim b/eth/utp/growable_buffer.nim index dfefb7a..093ce5b 100644 --- a/eth/utp/growable_buffer.nim +++ b/eth/utp/growable_buffer.nim @@ -5,7 +5,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - std/[options, math, sugar] + std/[options, math] export options @@ -64,8 +64,8 @@ proc calculateNextMask(currentMask: uint32, index:uint32): uint32 = # Increase mask,so that index will fit in buffer size i.e mask + 1 if currentMask == uint32.high: return currentMask - - var newSize = currentMask + 1 + + var newSize = currentMask + 1 while true: newSize = newSize * 2 if newSize == 0 or index < newSize: diff --git a/eth/utp/packets.nim b/eth/utp/packets.nim index 905154d..067fb27 100644 --- a/eth/utp/packets.nim +++ b/eth/utp/packets.nim @@ -7,10 +7,9 @@ {.push raises: [Defect].} import - std/[monotimes], faststreams, chronos, - stew/[endians2, results, objects, arrayops], + stew/[endians2, results, objects], ../p2p/discoveryv5/random2 export results, random2 diff --git a/eth/utp/utp_discv5_protocol.nim b/eth/utp/utp_discv5_protocol.nim index 9241b23..81b79e7 100644 --- a/eth/utp/utp_discv5_protocol.nim +++ b/eth/utp/utp_discv5_protocol.nim @@ -48,7 +48,7 @@ proc hash(x: UtpSocketKey[NodeAddress]): Hash = func `$`*(x: UtpSocketKey[NodeAddress]): string = "(remoteId: " & $x.remoteAddress.nodeId & ", remoteAddress: " & $x.remoteAddress.address & - ", rcvId: "& $x.rcvId & + ", rcvId: " & $x.rcvId & ")" proc talkReqDirect(p: protocol.Protocol, n: NodeAddress, protocol, request: seq[byte]): Future[void] = diff --git a/eth/utp/utp_protocol.nim b/eth/utp/utp_protocol.nim index 59819b2..db2d358 100644 --- a/eth/utp/utp_protocol.nim +++ b/eth/utp/utp_protocol.nim @@ -7,7 +7,7 @@ {.push raises: [Defect].} import - std/[tables, options, hashes, sugar, math], + std/[tables, options, hashes, math], chronos, chronicles, ./utp_router, ../keys diff --git a/tests/p2p/test_routing_table.nim b/tests/p2p/test_routing_table.nim index da2d5f0..64cac96 100644 --- a/tests/p2p/test_routing_table.nim +++ b/tests/p2p/test_routing_table.nim @@ -120,10 +120,10 @@ suite "Routing Table Tests": table.replaceNode(table.nodeToRevalidate()) block: # Should return the last node of the replacement cache successfully. - let result = table.getNode(lastNode.id) + let res = table.getNode(lastNode.id) check: - result.isSome() - result.get() == lastNode + res.isSome() + res.get() == lastNode block: # This node should be removed check (table.getNode(bucketNodes[bucketNodes.high].id)).isNone() @@ -186,10 +186,10 @@ suite "Routing Table Tests": for n in 0..