From fd139a9ddae4675f7dc79fdd12a99f2fc9c3b795 Mon Sep 17 00:00:00 2001 From: Sayan Nandan Date: Thu, 11 Feb 2021 12:38:23 +0530 Subject: [PATCH] No need to skip next value in `SSET` The skipping of the next value is absolutely unneeded as we're already exiting the loop when the hash table contains the key. Thus, this op was removed. Signed-off-by: Sayan Nandan --- server/src/kvengine/strong.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/src/kvengine/strong.rs b/server/src/kvengine/strong.rs index 176319a5..0343a875 100644 --- a/server/src/kvengine/strong.rs +++ b/server/src/kvengine/strong.rs @@ -50,6 +50,9 @@ pub async fn sset(handle: &CoreDB, con: &mut Con<'_>, act: ActionGroup) -> TResu // We use this additional scope to tell the compiler that the write lock // doesn't go beyond the scope of this function - and is never used across // an await: cause, the compiler ain't as smart as we are ;) + + // This iterator gives us the keys and values, skipping the first argument which + // is the action name let mut key_iter = act .get_ref() .get(1..) @@ -68,11 +71,6 @@ pub async fn sset(handle: &CoreDB, con: &mut Con<'_>, act: ActionGroup) -> TResu failed = Some(true); break; } - // Skip the next value that is coming our way, as we don't need it - // right now - let _ = key_iter - .next() - .unwrap_or_else(|| unsafe { unreachable_unchecked() }); } if !failed.unwrap_or_else(|| unsafe { // UNSAFE(@ohsayan): Completely safe because we've already set a value for `failed` earlier