diff options
author | Benjamin Shirley-Quirk | 2020-08-04 22:45:21 +0000 |
---|---|---|
committer | Benjamin Shirley-Quirk | 2020-08-04 22:45:21 +0000 |
commit | c54e6d24b70f21293612449c7a960e64077c5f89 (patch) | |
tree | 68d3b8bc1b7aacd2f622ceedb240be9e99300b82 /src/aur.nim | |
parent | b8d35dea8fb61ec177ab898b70404338f2ed477b (diff) |
refactored collect blocks
Diffstat (limited to 'src/aur.nim')
-rw-r--r-- | src/aur.nim | 16 |
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 |