aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-12 17:56:32 -0400
committerDeterminant <[email protected]>2020-06-12 17:56:32 -0400
commit99400b63e374f84d4c642d3cf73efdbb71454619 (patch)
treeb1b445ede4a8085696239d29148f4fe0e9b5c36e /tests
parente39324e62ab4e09fb0dfc7784519e77fedca65cb (diff)
...
Diffstat (limited to 'tests')
-rw-r--r--tests/common/mod.rs19
1 files changed, 10 insertions, 9 deletions
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 {