diff --git a/compiler/main.nim b/compiler/main.nim index e573f77cb5b10..0b538cb5aaad5 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -226,6 +226,11 @@ proc mainCommand*(graph: ModuleGraph) = commandDoc(cache, conf) of "doc2", "doc": conf.setNoteDefaults(warnLockLevel, false) # issue #13218 + conf.setNoteDefaults(warnRedefinitionOfLabel, false) # issue #13218 + # because currently generates lots of false positives due to conflation + # of labels links in doc comments, eg for random.rand: + # ## * `rand proc<#rand,Rand,Natural>`_ that returns an integer + # ## * `rand proc<#rand,Rand,range[]>`_ that returns a float when defined(leanCompiler): quit "compiler wasn't built with documentation generator" else: diff --git a/doc/docgen_sample.nim b/doc/docgen_sample.nim index 8759931873b8c..7a167cb4572fc 100644 --- a/doc/docgen_sample.nim +++ b/doc/docgen_sample.nim @@ -4,9 +4,9 @@ import strutils proc helloWorld*(times: int) = ## Takes an integer and outputs - ## as many "hello world!"s + ## as many indented "hello world!"s for i in 0 .. times-1: - echo "hello world!" + echo "hello world!".indent(2) # using indent to avoid `UnusedImport` helloWorld(5) diff --git a/lib/impure/rdstdin.nim b/lib/impure/rdstdin.nim index b78c0d8cf7a46..4c36afe6e0c82 100644 --- a/lib/impure/rdstdin.nim +++ b/lib/impure/rdstdin.nim @@ -43,7 +43,7 @@ elif defined(genode): stdin.readLine(line) else: - import linenoise, termios + import linenoise proc readLineFromStdin*(prompt: string): TaintedString {. tags: [ReadIOEffect, WriteIOEffect].} = diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index d724242d7170d..e140cbef26102 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -168,7 +168,7 @@ include "system/inclrtl" -import os, tables, strutils, times, heapqueue, lists, options, asyncstreams +import os, tables, strutils, times, heapqueue, options, asyncstreams import options, math, std/monotimes import asyncfutures except callSoon diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index 9aed0255bbf36..a710823c5d05a 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -84,7 +84,7 @@ ## let server = newAsyncHttpServer(maxBody = 10485760, stream = stream) # 10 MB ## waitFor server.serve(Port(8080), cb) -import tables, asyncnet, asyncdispatch, parseutils, uri, strutils +import asyncnet, asyncdispatch, parseutils, uri, strutils import httpcore export httpcore except parseHeader diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim index e3be1764bf604..ff9c3889af50c 100644 --- a/lib/pure/encodings.nim +++ b/lib/pure/encodings.nim @@ -10,7 +10,7 @@ ## Converts between different character encodings. On UNIX, this uses ## the `iconv`:idx: library, on Windows the Windows API. -import os, parseutils, strutils +import os when not defined(windows): type @@ -28,6 +28,7 @@ type ## for encoding errors when defined(windows): + import parseutils, strutils proc eqEncodingNames(a, b: string): bool = var i = 0 var j = 0 diff --git a/lib/pure/lenientops.nim b/lib/pure/lenientops.nim index cdea780a2d92a..f73df5e5f6fba 100644 --- a/lib/pure/lenientops.nim +++ b/lib/pure/lenientops.nim @@ -24,8 +24,6 @@ ## either casting to float or rounding to int might be preferred, and users ## should make an explicit choice. -import typetraits - proc `+`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.noSideEffect, inline.} = F(i) + f proc `+`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.noSideEffect, inline.} = diff --git a/lib/pure/selectors.nim b/lib/pure/selectors.nim index 0ab1e77548295..3b829273ce131 100644 --- a/lib/pure/selectors.nim +++ b/lib/pure/selectors.nim @@ -27,7 +27,7 @@ ## ## TODO: ``/dev/poll``, ``event ports`` and filesystem events. -import os, strutils, nativesockets +import os, nativesockets const hasThreadSupport = compileOption("threads") and defined(threadsafe) diff --git a/lib/pure/strformat.nim b/lib/pure/strformat.nim index bc0d4b069283d..838baaf0267f8 100644 --- a/lib/pure/strformat.nim +++ b/lib/pure/strformat.nim @@ -744,8 +744,6 @@ when isMainModule: check &"{high(int64)}", "9223372036854775807" check &"{low(int64)}", "-9223372036854775808" - import json - doAssert fmt"{'a'} {'b'}" == "a b" echo("All tests ok") diff --git a/tools/kochdocs.nim b/tools/kochdocs.nim index 4a07b7fd9df19..6012a6fbf5c08 100644 --- a/tools/kochdocs.nim +++ b/tools/kochdocs.nim @@ -145,8 +145,10 @@ lib/posix/linux.nim lib/posix/termios.nim lib/js/jscore.nim """.splitWhitespace() - + + # some of these are include files so shouldn't be docgen'd ignoredModules = """ +lib/prelude.nim lib/pure/future.nim lib/impure/osinfo_posix.nim lib/impure/osinfo_win.nim