From fa6e1f02f541f2f34c2cddb60372e144dbdc9358 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Thu, 14 Dec 2023 20:45:20 +0200 Subject: [PATCH] clippy --- swap/src/api.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/swap/src/api.rs b/swap/src/api.rs index 54b229e9..bd99f013 100644 --- a/swap/src/api.rs +++ b/swap/src/api.rs @@ -35,13 +35,10 @@ pub struct Config { use uuid::Uuid; +#[derive(Default)] pub struct PendingTaskList(Mutex>>); impl PendingTaskList { - pub fn new() -> Self { - Self(Mutex::new(Vec::new())) - } - pub async fn spawn(&self, future: F) where F: Future + Send + 'static, @@ -105,8 +102,7 @@ impl SwapLock { } pub async fn get_current_swap_id(&self) -> Option { - let current_swap = *self.current_swap.read().await; - current_swap + *self.current_swap.read().await } /// Sends a signal to suspend all ongoing swap processes. @@ -244,7 +240,7 @@ impl Context { data_dir, }, swap_lock: Arc::new(SwapLock::new()), - tasks: Arc::new(PendingTaskList::new()), + tasks: Arc::new(PendingTaskList::default()), }; Ok(context) @@ -268,7 +264,7 @@ impl Context { .expect("Could not open sqlite database"), monero_rpc_process: None, swap_lock: Arc::new(SwapLock::new()), - tasks: Arc::new(PendingTaskList::new()), + tasks: Arc::new(PendingTaskList::default()), } } }