From 604073be00e6a78e33d4c4c1babf69aa1ed0d7b7 Mon Sep 17 00:00:00 2001 From: Marius Kriegerowski Date: Sun, 17 Nov 2024 10:19:53 +0100 Subject: [PATCH] simplify return value check waiting for connected state --- lib/src/client/session/session.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/src/client/session/session.rs b/lib/src/client/session/session.rs index 9402ac5aa..9f188c7d1 100644 --- a/lib/src/client/session/session.rs +++ b/lib/src/client/session/session.rs @@ -150,17 +150,13 @@ impl Session { async fn wait_for_state(&self, connected: bool) -> bool { let mut rx = self.state_watch_rx.clone(); - let res = match rx + let res = rx .wait_for(|s| { connected && matches!(*s, SessionState::Connected) || !connected && matches!(*s, SessionState::Disconnected) }) .await - { - Ok(_) => true, - Err(_) => false, - }; - + .is_ok(); res }