chore: unused imports are now errors (#1399)

This commit is contained in:
Miran
2025-05-26 21:36:08 +02:00
committed by GitHub
parent c3dae6a7d4
commit 7275f6f9c3
10 changed files with 26 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ if dirExists("nimbledeps/pkgs"):
if dirExists("nimbledeps/pkgs2"):
switch("NimblePath", "nimbledeps/pkgs2")
switch("warningAsError", "UnusedImport:on")
switch("warning", "CaseTransition:off")
switch("warning", "ObservableStores:off")
switch("warning", "LockLevel:off")

View File

@@ -10,6 +10,7 @@
## This module implementes CID (Content IDentifier).
{.push raises: [].}
{.used.}
import tables, hashes
import multibase, multicodec, multihash, vbuffer, varint, results

View File

@@ -10,6 +10,7 @@
## This module implements MultiCodec.
{.push raises: [].}
{.used.}
import tables, hashes
import vbuffer

View File

@@ -22,6 +22,7 @@
## 2. MURMUR
{.push raises: [].}
{.used.}
import tables
import nimcrypto/[sha, sha2, keccak, blake2, hash, utils]

View File

@@ -11,6 +11,7 @@
{.push raises: [].}
{.push public.}
{.used.}
import
std/[hashes, strutils],

View File

@@ -4,7 +4,7 @@ const
libp2p_pubsub_verify {.booldefine.} = true
libp2p_pubsub_anonymize {.booldefine.} = false
import hashes, random, tables, sets, sequtils, sugar
import hashes, random, tables, sets, sequtils
import chronos, results, stew/byteutils, chronos/ratelimit
import
../../libp2p/[

View File

@@ -1,3 +1,3 @@
{.used.}
import testnative, testdaemon, ./pubsub/testpubsub, testinterop
import testnative, ./pubsub/testpubsub, testinterop, testdaemon

View File

@@ -108,17 +108,16 @@ proc pubsubTest(f: set[P2PDaemonFlags]): Future[bool] {.async.} =
if resultsCount == 2:
result = true
when isMainModule:
suite "libp2p-daemon test suite":
test "Simple spawn and get identity test":
check:
waitFor(identitySpawnTest()) == true
test "Connect/Accept peer/stream test":
check:
waitFor(connectStreamTest()) == true
asyncTest "GossipSub test":
checkUntilTimeout:
(await pubsubTest({PSGossipSub}))
asyncTest "FloodSub test":
checkUntilTimeout:
(await pubsubTest({PSFloodSub}))
suite "libp2p-daemon test suite":
test "Simple spawn and get identity test":
check:
waitFor(identitySpawnTest()) == true
test "Connect/Accept peer/stream test":
check:
waitFor(connectStreamTest()) == true
asyncTest "GossipSub test":
checkUntilTimeout:
(await pubsubTest({PSGossipSub}))
asyncTest "FloodSub test":
checkUntilTimeout:
(await pubsubTest({PSFloodSub}))

View File

@@ -1,3 +1,5 @@
{.used.}
import helpers, commoninterop
import ../libp2p
import ../libp2p/crypto/crypto, ../libp2p/protocols/connectivity/relay/relay

View File

@@ -9,7 +9,7 @@
# This file may not be copied, modified, or distributed except according to
# those terms.
import std/[strutils, sequtils, tables]
import std/[sequtils, tables]
import chronos
import
../libp2p/[
@@ -36,6 +36,9 @@ const unixPlatform =
defined(linux) or defined(solaris) or defined(macosx) or defined(freebsd) or
defined(netbsd) or defined(openbsd) or defined(dragonfly)
when unixPlatform:
import std/strutils
proc guessOsNameServers(): seq[TransportAddress] =
when unixPlatform:
var resultSeq = newSeqOfCap[TransportAddress](3)