From ecc0bc3f442256c052c5502c2b7118c16321351f Mon Sep 17 00:00:00 2001 From: Robin Appelman <robin@icewind.nl> Date: Fri, 10 Dec 2021 14:49:51 +0100 Subject: [PATCH] clippy fixes Signed-off-by: Robin Appelman <robin@icewind.nl> --- src/message.rs | 7 +++---- tests/integration.rs | 11 ++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/message.rs b/src/message.rs index 378f3aa..a9b0707 100644 --- a/src/message.rs +++ b/src/message.rs @@ -56,9 +56,8 @@ pub enum PushMessage { impl PushMessage { pub fn merge(&mut self, other: &PushMessage) { - match (self, other) { - (PushMessage::File(a), PushMessage::File(b)) => a.extend(b), - _ => {} + if let (PushMessage::File(a), PushMessage::File(b)) = (self, other) { + a.extend(b) } } @@ -156,7 +155,7 @@ impl SendQueue { None } - pub fn drain<'a>(&'a mut self, now: Instant) -> impl Iterator<Item = PushMessage> + 'a { + pub fn drain(&mut self, now: Instant) -> impl Iterator<Item = PushMessage> + '_ { self.items.iter_mut().filter_map(move |item| { let debounce_time = item.message.as_ref()?.debounce_time(); if now.duration_since(item.sent) > debounce_time { diff --git a/tests/integration.rs b/tests/integration.rs index 2a5bf07..9927023 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -30,12 +30,9 @@ static LAST_PORT: Lazy<Mutex<u16>> = Lazy::new(|| Mutex::new(1024)); async fn listen_available_port() -> Option<TcpListener> { let mut last_port = LAST_PORT.lock().unwrap(); for port in (*last_port + 1)..65535 { - match TcpListener::bind(("127.0.0.1", port)).await { - Ok(tcp) => { - *last_port = port; - return Some(tcp); - } - _ => {} + if let Ok(tcp) = TcpListener::bind(("127.0.0.1", port)).await { + *last_port = port; + return Some(tcp); } } @@ -154,7 +151,7 @@ impl Services { nextcloud_url: format!("http://{}/", self.nextcloud), metrics_bind: None, log_level: "".to_string(), - bind: Bind::Tcp(self.nextcloud.clone()), + bind: Bind::Tcp(self.nextcloud), allow_self_signed: false, no_ansi: false, tls: None, -- GitLab