From ef462c786af1b6c6bc4e9e28cd7993580fcf6673 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 15 Sep 2022 16:18:39 +0200 Subject: [PATCH] refactor(sdk): Clean up sync_with_callback implementation --- crates/matrix-sdk/src/client/mod.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/matrix-sdk/src/client/mod.rs b/crates/matrix-sdk/src/client/mod.rs index 85b077b45..59e35eb29 100644 --- a/crates/matrix-sdk/src/client/mod.rs +++ b/crates/matrix-sdk/src/client/mod.rs @@ -2448,12 +2448,13 @@ impl Client { C: Future, { self.sync_with_result_callback(sync_settings, |result| async { - if let Ok(sync_response) = result { - callback(sync_response).await - } else { - warn!("Error from sync with result: {}", result.err().unwrap()); - // do not make a decision about control loop by default - LoopCtrl::Continue + match result { + Ok(sync_response) => callback(sync_response).await, + Err(e) => { + warn!("Error from sync with result: {e}"); + // continue the loop in case of error + LoopCtrl::Continue + } } }) .await;