refactor: use let..else in create_or_lookup_group()

This commit is contained in:
link2xt
2024-05-19 22:38:59 +00:00
parent e9cef4b0ba
commit cff5c064a6

View File

@@ -1829,18 +1829,18 @@ async fn create_or_lookup_group(
to_ids: &[ContactId], to_ids: &[ContactId],
verified_encryption: &VerifiedEncryption, verified_encryption: &VerifiedEncryption,
) -> Result<Option<(ChatId, Blocked)>> { ) -> Result<Option<(ChatId, Blocked)>> {
let grpid = if let Some(grpid) = try_getting_grpid(mime_parser) { let Some(grpid) = try_getting_grpid(mime_parser) else {
grpid if is_partial_download {
} else if is_partial_download { // Partial download may be an encrypted message with protected Subject header.
// Partial download may be an encrypted message with protected Subject header. //
// // We do not want to create a group with "..." or "Encrypted message" as a subject.
// We do not want to create a group with "..." or "Encrypted message" as a subject. info!(
info!( context,
context, "Ad-hoc group cannot be created from partial download."
"Ad-hoc group cannot be created from partial download." );
); return Ok(None);
return Ok(None); }
} else {
let mut member_ids: Vec<ContactId> = to_ids.to_vec(); let mut member_ids: Vec<ContactId> = to_ids.to_vec();
if !member_ids.contains(&(from_id)) { if !member_ids.contains(&(from_id)) {
member_ids.push(from_id); member_ids.push(from_id);