From f7cc4c93d6b10a4ff214a9346d27f1823e8b436d Mon Sep 17 00:00:00 2001 From: Gary Pennington Date: Wed, 14 Jun 2023 15:29:51 +0100 Subject: [PATCH] remove redunant compare of previous and 1 since that's what the compare_exchange does... --- src/config/hashing.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/config/hashing.rs b/src/config/hashing.rs index 986ed836..46fd1402 100644 --- a/src/config/hashing.rs +++ b/src/config/hashing.rs @@ -55,12 +55,11 @@ impl HokmaLock { .lock .compare_exchange(1, 1, Ordering::Acquire, Ordering::Relaxed) { - if previous != 1 { - return WhenTheHokmaSuppression { - hokma: self, - state: previous, - }; - } + // If we failed, previous cannot be 1 + return WhenTheHokmaSuppression { + hokma: self, + state: previous, + }; } } }