From a522b09f790e17387de9f8faa40a9094f322bcc6 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 2 Jan 2024 15:43:47 +0100 Subject: [PATCH] Use let-else in some more places --- cove/src/ui.rs | 5 ++--- cove/src/ui/euph/room.rs | 5 +---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cove/src/ui.rs b/cove/src/ui.rs index cb85876..95cc4d1 100644 --- a/cove/src/ui.rs +++ b/cove/src/ui.rs @@ -181,9 +181,8 @@ impl Ui { } // Handle events (in batches) - let mut event = match event_rx.recv().await { - Some(event) => event, - None => return Ok(()), + let Some(mut event) = event_rx.recv().await else { + return Ok(()); }; let end_time = Instant::now() + EVENT_PROCESSING_TIME; loop { diff --git a/cove/src/ui/euph/room.rs b/cove/src/ui/euph/room.rs index 7fa266f..defb955 100644 --- a/cove/src/ui/euph/room.rs +++ b/cove/src/ui/euph/room.rs @@ -532,10 +532,7 @@ impl EuphRoom { } pub async fn handle_event(&mut self, event: Event) -> bool { - let room = match &self.room { - None => return false, - Some(room) => room, - }; + let Some(room) = &self.room else { return false }; if event.config().name != room.instance().config().name { // If we allowed names other than the current one, old instances