summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-08-27 19:18:56 +0200
committerGitHub <noreply@github.com>2019-08-27 19:18:56 +0200
commit114da04cbbaa7930a38ba8ca59229447aee7b40f (patch)
tree9e832fb5740bfc334b97d5eaef357965c481c28f /doc
parentd8177a398059334a7d36c1ba0d98b39516815edd (diff)
downloadNim-114da04cbbaa7930a38ba8ca59229447aee7b40f.tar.gz
fixes #12029; finish the 'unused import' feature (#12064)
Diffstat (limited to 'doc')
-rw-r--r--doc/manual.rst11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index f0945f78d..1f8f23310 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -6276,6 +6276,17 @@ is particularly useful when the symbol was generated by a macro:
   implementArithOps(int)
   echoAdd 3, 5
 
+``used`` can also be used as a top level statement to mark a module as "used".
+This prevents the "Unused import" warning:
+
+.. code-block:: nim
+
+  # module: debughelper.nim
+  when defined(nimHasUsed):
+    # 'import debughelper' is so useful for debugging
+    # that Nim shouldn't produce a warning for that import,
+    # even if currently unused:
+    {.used.}
 
 
 experimental pragma