From 3b1e4b35344c6d270cd1d37683a9d30983805d5f Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Tue, 14 Dec 2021 15:51:46 -0700 Subject: [PATCH] code review edits --- patch-db/Cargo.toml | 2 +- patch-db/src/locker.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/patch-db/Cargo.toml b/patch-db/Cargo.toml index abe2de4..75dc2e4 100644 --- a/patch-db/Cargo.toml +++ b/patch-db/Cargo.toml @@ -19,7 +19,7 @@ trace = ["debug", "tracing-error"] async-trait = "0.1.42" fd-lock-rs = "0.1.3" futures = "0.3.8" -im = "*" +imbl = "1.0.1" json-patch = { path = "../json-patch" } json-ptr = { path = "../json-ptr" } lazy_static = "1.4.0" diff --git a/patch-db/src/locker.rs b/patch-db/src/locker.rs index 394de2d..24a3907 100644 --- a/patch-db/src/locker.rs +++ b/patch-db/src/locker.rs @@ -1,6 +1,6 @@ use std::collections::{BTreeMap, VecDeque}; -use im::{ordset, OrdSet}; +use imbl::{ordset, OrdSet}; use json_ptr::{JsonPointer, SegList}; use tokio::sync::{mpsc, oneshot}; @@ -73,7 +73,9 @@ impl Locker { &mut locks_on_lease, &mut request_queue, ); - hot_seat.map_or((), |a| request_queue.push_front(a)); + if let Some(hot_seat) = hot_seat { + request_queue.push_front(hot_seat); + } } Action::HandleRelease(lock_info) => { // release actual lock @@ -106,7 +108,9 @@ impl Locker { &mut request_queue, ) } - hot_seat.map_or((), |a| request_queue.push_front(a)); + if let Some(hot_seat) = hot_seat { + request_queue.push_front(hot_seat); + } } } Action::HandleCancel(lock_info) => {