From c7039bae5d29a47bfef1920a4d367523eadabd86 Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Sun, 19 Jan 2025 01:19:20 +0300 Subject: [PATCH] Use `is_none_or` (#393) --- src/core/common_conditions.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/common_conditions.rs b/src/core/common_conditions.rs index 50a6e653..11e3f76b 100644 --- a/src/core/common_conditions.rs +++ b/src/core/common_conditions.rs @@ -12,10 +12,7 @@ pub fn server_running(server: Option>) -> bool { /// Can be used instead of the regular [`server_running`] to seamlessly support /// singleplayer or listen-server mode (where server is also a player). pub fn server_or_singleplayer(client: Option>) -> bool { - let Some(client) = client else { - return true; - }; - client.is_disconnected() + client.is_none_or(|client| client.is_disconnected()) } /// Returns `true` when the client is connecting.