From a7ee4b170ab7efd1fa921aab97896886f9a3e8a7 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Tue, 11 Mar 2025 09:12:34 +0100 Subject: [PATCH] Use short syntax with nim-results --- datastore/tieredds.nim | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/datastore/tieredds.nim b/datastore/tieredds.nim index cacc119..c86774f 100644 --- a/datastore/tieredds.nim +++ b/datastore/tieredds.nim @@ -47,8 +47,7 @@ method delete*( pending = await allFinished(self.stores.mapIt(it.delete(key))) for fut in pending: - let res = await fut - if res.isErr: return res + ? await fut return success() @@ -61,8 +60,7 @@ method delete*( pending = await allFinished(self.stores.mapIt(it.delete(key))) for fut in pending: - let res = await fut - if res.isErr: return res + ? await fut return success() @@ -99,8 +97,7 @@ method put*( pending = await allFinished(self.stores.mapIt(it.put(key, data))) for fut in pending: - let res = await fut - if res.isErr: return res + ? await fut return success() @@ -113,8 +110,7 @@ method put*( pending = await allFinished(self.stores.mapIt(it.put(entry.key, entry.data))) for fut in pending: - let res = await fut - if res.isErr: return res + ? await fut return success() @@ -129,9 +125,8 @@ method modifyGet*( var aux = newSeq[byte]() for fut in pending: - let res = await fut - if res.isErr: return res - aux.add(res.get) + let res = ? await fut + aux.add(res) return success(aux) @@ -144,8 +139,7 @@ method modify*( pending = await allFinished(self.stores.mapIt(it.modify(key, fn))) for fut in pending: - let res = await fut - if res.isErr: return res + ? await fut return success()