aboutsummaryrefslogtreecommitdiff
path: root/src/aur.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/aur.nim
parentb8d35dea8fb61ec177ab898b70404338f2ed477b (diff)
refactored collect blocks
Diffstat (limited to 'src/aur.nim')
-rw-r--r--src/aur.nim16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/aur.nim b/src/aur.nim
index a8be70b..542a21c 100644
--- a/src/aur.nim
+++ b/src/aur.nim
@@ -76,12 +76,11 @@ proc getRpcPackageInfos*(pkgs: seq[string], repo: string, useTimeout: bool):
for y in parseJson(z)["results"]:
for x in parseRpcPackageInfo(y,repo):
{x.name:x}
- block:
- let tmp = collect(newSeq):
- for p in pkgs:
- for x in table.opt(p):
- x
- (tmp,none(string))
+ ((block:collect(newSeq):
+ for p in pkgs:
+ for x in table.opt(p):
+ x
+ ),none(string))
else:
let table = lc[(x.name, x) | (z <- responses, y <- parseJson(z)["results"],
x <- parseRpcPackageInfo(y, repo)), (string, RpcPackageInfo)].toTable
@@ -109,11 +108,10 @@ proc getAurPackageInfos*(pkgs: seq[string], repo: string, arch: string, useTimeo
]
when NimVersion >= "1.2":
- let deduplicated = block:
- let tmp = collect(newSeq):
+ let deduplicated = deduplicate:
+ collect(newSeq):
for x in rpcInfos:
x.base
- tmp.deduplicate
else:
let deduplicated = lc[x.base | (x <- rpcInfos), string].deduplicate