From 5f601a209e35c73eb0baefe861900404f8f8b874 Mon Sep 17 00:00:00 2001 From: Sashanoraa Date: Wed, 26 Mar 2025 01:21:24 -0400 Subject: [PATCH] Collapse nested if statements --- bin/src/daemon.rs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/bin/src/daemon.rs b/bin/src/daemon.rs index 7a221a3..767e6dc 100644 --- a/bin/src/daemon.rs +++ b/bin/src/daemon.rs @@ -102,20 +102,18 @@ async fn init_qmdl_store(config: &config::Config) -> Result Ok(store), - Err(RecordingStoreError::ParseManifestError(err)) => { - error!("failed to parse QMDL manifest: {}", err); - info!("creating new empty manifest..."); - Ok(RecordingStore::create(&config.qmdl_store_path).await?) - }, - Err(err) => Err(err.into()), - } - } else { - Ok(RecordingStore::create(&config.qmdl_store_path).await?) + } else if store_exists { + match RecordingStore::load(&config.qmdl_store_path).await { + Ok(store) => Ok(store), + Err(RecordingStoreError::ParseManifestError(err)) => { + error!("failed to parse QMDL manifest: {}", err); + info!("creating new empty manifest..."); + Ok(RecordingStore::create(&config.qmdl_store_path).await?) + }, + Err(err) => Err(err.into()), } + } else { + Ok(RecordingStore::create(&config.qmdl_store_path).await?) } }