refactor: use let-else in resend_msgs()

This commit is contained in:
link2xt
2023-07-07 21:20:57 +00:00
parent 17a6c88cc7
commit 80fac3f1b8

View File

@@ -3604,7 +3604,10 @@ pub async fn resend_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> {
msgs.push(msg) msgs.push(msg)
} }
if let Some(chat_id) = chat_id { let Some(chat_id) = chat_id else {
return Ok(());
};
let chat = Chat::load_from_db(context, chat_id).await?; let chat = Chat::load_from_db(context, chat_id).await?;
for mut msg in msgs { for mut msg in msgs {
if msg.get_showpadlock() && !chat.is_protected() { if msg.get_showpadlock() && !chat.is_protected() {
@@ -3628,7 +3631,6 @@ pub async fn resend_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> {
.await; .await;
} }
} }
}
Ok(()) Ok(())
} }