summary refs log tree commit diff stats
path: root/lib/pure/collections/tableimpl.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-11-05 16:12:53 +0800
committerGitHub <noreply@github.com>2023-11-05 09:12:53 +0100
commitf0e5bdd7d8575d6456a7fc489e203e979d0926b3 (patch)
tree87758a1e3fa2e297d024b3f1767f448e183dd406 /lib/pure/collections/tableimpl.nim
parentec37b59a6552ed4a989e4c3cb1970fb970152e04 (diff)
downloadNim-f0e5bdd7d8575d6456a7fc489e203e979d0926b3.tar.gz
fixes #22898; fix #22883 differently (#22900)
fixes #22898
In these cases, the tables/sets are clears or elements are deleted from
them. It's reasonable to suppress warnings because the value is not
accessed anymore, which means it's safe to ignore the warnings.
Diffstat (limited to 'lib/pure/collections/tableimpl.nim')
-rw-r--r--lib/pure/collections/tableimpl.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pure/collections/tableimpl.nim b/lib/pure/collections/tableimpl.nim
index 9bccc8d96..630af3970 100644
--- a/lib/pure/collections/tableimpl.nim
+++ b/lib/pure/collections/tableimpl.nim
@@ -119,8 +119,10 @@ template delImplIdx(t, i, makeEmpty, cellEmpty, cellHash) =
         var j = i         # The correctness of this depends on (h+1) in nextTry
         var r = j         # though may be adaptable to other simple sequences.
         makeEmpty(i)                     # mark current EMPTY
+        {.push warning[UnsafeDefault]:off.}
         reset(t.data[i].key)
         reset(t.data[i].val)
+        {.pop.}
         while true:
           i = (i + 1) and msk            # increment mod table size
           if cellEmpty(i):               # end of collision cluster; So all done
@@ -151,8 +153,10 @@ template clearImpl() {.dirty.} =
   for i in 0 ..< t.dataLen:
     when compiles(t.data[i].hcode): # CountTable records don't contain a hcode
       t.data[i].hcode = 0
+    {.push warning[UnsafeDefault]:off.}
     reset(t.data[i].key)
     reset(t.data[i].val)
+    {.pop.}
   t.counter = 0
 
 template ctAnd(a, b): bool =