From 99400b63e374f84d4c642d3cf73efdbb71454619 Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 12 Jun 2020 17:56:32 -0400 Subject: ... --- tests/common/mod.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 47b04f1..ba35654 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,6 +1,6 @@ #[cfg(test)] + #[allow(dead_code)] -extern crate growthring; use async_trait::async_trait; use growthring::wal::{ WALBytes, WALFile, WALLoader, WALPos, WALRingId, WALStore, @@ -449,14 +449,15 @@ impl Canvas { self.queue.remove(&pos); } self.canvas[pos as usize] = c; - let cnt = self.waiting.get_mut(&rid).unwrap(); - *cnt -= 1; - if *cnt == 0 { - self.waiting.remove(&rid); - Some(rid) - } else { - None - } + if let Some(cnt) = self.waiting.get_mut(&rid) { + *cnt -= 1; + if *cnt == 0 { + self.waiting.remove(&rid); + Some(rid) + } else { + None + } + } else { None } } pub fn is_same(&self, other: &Canvas) -> bool { -- cgit v1.2.3-70-g09d2