Skip to content

Commit fc28bcc

Browse files
committed
Use if-let
1 parent 1be61a1 commit fc28bcc

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/sync.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -779,14 +779,13 @@ pub(crate) async fn sync_task(
779779
let logger_tx = logger_tx.clone();
780780

781781
fn send_trim(site_path: String, dirtylog_cmd_tx: UnboundedSender<DirtyLogCommand>) {
782-
dirtylog_cmd_tx.unbounded_send(DirtyLogCommand::Trim { site: site_path })
783-
.unwrap_or_else(|e| {
784-
let err_msg = e.to_string();
785-
let DirtyLogCommand::Trim {site} = e.into_inner() else {
786-
panic!("Logic error")
787-
};
788-
log::error!("Cannot send dirtylog Trim command for site {site}: {err_msg}")
789-
});
782+
if let Err(e) = dirtylog_cmd_tx.unbounded_send(DirtyLogCommand::Trim { site: site_path }) {
783+
let err_msg = e.to_string();
784+
let DirtyLogCommand::Trim {site} = e.into_inner() else {
785+
panic!("Logic error")
786+
};
787+
log::error!("Cannot send dirtylog Trim command for site {site}: {err_msg}")
788+
}
790789
}
791790

792791
match sub_hp {

0 commit comments

Comments
 (0)