From 56af2c47d53df77a8a234d1ed65960ed1f631a20 Mon Sep 17 00:00:00 2001 From: David Palm Date: Thu, 31 May 2018 11:50:36 +0200 Subject: [PATCH] Don't compare rc against i32::MIN --- util/memorydb/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/util/memorydb/src/lib.rs b/util/memorydb/src/lib.rs index 2439819a498..1318b445d35 100644 --- a/util/memorydb/src/lib.rs +++ b/util/memorydb/src/lib.rs @@ -176,7 +176,7 @@ impl MemoryDB { } impl HashDB for MemoryDB { - type H = H; // REVIEW this is a bit confusing, but not sure what is better (e.g. using `impl … … type H = HH;`) + type H = H; // REVIEW: this method is what made it necessary to add a type param to H256FastMap, which I'd rather have avoided. // The problem is that the keys returned are `H256` and type inference fails on the `collect()` call. @@ -222,7 +222,7 @@ impl HashDB for MemoryDB { match self.data.entry(key) { Entry::Occupied(mut entry) => { let &mut (ref mut old_value, ref mut rc) = entry.get_mut(); - if *rc >= -0x80000000i32 && *rc <= 0 { + if *rc <= 0 { *old_value = DBValue::from_slice(value); } *rc += 1; @@ -242,7 +242,7 @@ impl HashDB for MemoryDB { match self.data.entry(key) { Entry::Occupied(mut entry) => { let &mut (ref mut old_value, ref mut rc) = entry.get_mut(); - if *rc >= -0x80000000i32 && *rc <= 0 { + if *rc <= 0 { *old_value = value; } *rc += 1;