mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
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
(cherry picked from commit fb6fa96979)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user