Fix one clippy::unneeded_unwrap warning

This commit is contained in:
Dmitry Bogatov
2019-08-27 23:00:37 +00:00
parent 19a0071585
commit 0a9f61783d

View File

@@ -1414,15 +1414,11 @@ pub unsafe fn add_contact_to_chat_ex(
let contact = contact.unwrap(); let contact = contact.unwrap();
/*this also makes sure, not contacts are added to special or normal chats*/ /*this also makes sure, not contacts are added to special or normal chats*/
let chat = Chat::load_from_db(context, chat_id); if let Ok(mut chat) = Chat::load_from_db(context, chat_id) {
if !(!real_group_exists(context, chat_id) if !(!real_group_exists(context, chat_id)
|| !Contact::real_exists_by_id(context, contact_id) || !Contact::real_exists_by_id(context, contact_id)
&& contact_id != DC_CONTACT_ID_SELF as u32 && contact_id != DC_CONTACT_ID_SELF as u32)
|| chat.is_err())
{ {
let mut chat = chat.unwrap();
if !(is_contact_in_chat(context, chat_id, 1 as u32) == 1) { if !(is_contact_in_chat(context, chat_id, 1 as u32) == 1) {
log_event!( log_event!(
context, context,
@@ -1432,7 +1428,9 @@ pub unsafe fn add_contact_to_chat_ex(
); );
} else { } else {
/* we should respect this - whatever we send to the group, it gets discarded anyway! */ /* we should respect this - whatever we send to the group, it gets discarded anyway! */
if 0 != flags & 0x1 && chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 1 { if 0 != flags & 0x1
&& chat.param.get_int(Param::Unpromoted).unwrap_or_default() == 1
{
chat.param.remove(Param::Unpromoted); chat.param.remove(Param::Unpromoted);
chat.update_param().unwrap(); chat.update_param().unwrap();
} }
@@ -1491,6 +1489,7 @@ pub unsafe fn add_contact_to_chat_ex(
} }
} }
} }
};
success success
} }