aboutsummaryrefslogtreecommitdiff
path: root/src/common.nim
diff options
context:
space:
mode:
authorBenjamin Shirley-Quirk2020-08-04 22:45:21 +0000
committerBenjamin Shirley-Quirk2020-08-04 22:45:21 +0000
commitc54e6d24b70f21293612449c7a960e64077c5f89 (patch)
tree68d3b8bc1b7aacd2f622ceedb240be9e99300b82 /src/common.nim
parentb8d35dea8fb61ec177ab898b70404338f2ed477b (diff)
refactored collect blocks
Diffstat (limited to 'src/common.nim')
-rw-r--r--src/common.nim5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/common.nim b/src/common.nim
index 8dc41c8..0f2804b 100644
--- a/src/common.nim
+++ b/src/common.nim
@@ -154,13 +154,12 @@ proc findSyncTargets*(handle: ptr AlpmHandle, dbs: seq[ptr AlpmDatabase],
else:
if allowGroups and target.reference.constraint.isNone:
when NimVersion >= "1.2":
- let groupRepo = block:
- let tmp = collect(newSeq):
+ let groupRepo = optFirst:
+ collect(newSeq):
for d in dbs:
for g in d.groups:
if $g.name == target.reference.name:
d
- tmp.optFirst
else:
let groupRepo = lc[d | (d <- dbs, g <- d.groups,
$g.name == target.reference.name), ptr AlpmDatabase].optFirst