From fb6fa9697907e387b1408320a070c263ad19201b Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 23 Mar 2026 20:31:09 +0800 Subject: [PATCH] fixes #25626; Fix injection variable declaration in sequtils.nim (#25629) fixes #25626 This pull request introduces a small change to the `mapIt` template in `sequtils.nim`. The update adds the `used` pragma to the injected `it` variable, which can help suppress unused variable warnings in certain cases. - Added the `used` pragma to the injected `it` variable in the `mapIt` template to prevent unused variable warnings. or it should give a better warning or something if `it` is not used --- lib/pure/collections/sequtils.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pure/collections/sequtils.nim b/lib/pure/collections/sequtils.nim index 3dba087aa8..299349a05a 100644 --- a/lib/pure/collections/sequtils.nim +++ b/lib/pure/collections/sequtils.nim @@ -1092,7 +1092,7 @@ template mapIt*(s: typed, op: untyped): untyped = type OutType = typeof(( block: - var it{.inject.}: typeof(items(s), typeOfIter); + var it{.inject, used.}: typeof(items(s), typeOfIter); op), typeOfProc) when OutType is not (proc): # Here, we avoid to create closures in loops.