From 400740fdbaa826f84880621fe6e692fcd30c5dd0 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sat, 7 Sep 2019 03:03:35 +0000 Subject: [PATCH] Simplify prepare_msg_raw() using early return This commit will fail CI due incorrect formatting. It is done deliberately to simplify review process. --- src/chat.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index b716ab174..874af1b20 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -258,7 +258,10 @@ impl<'a> Chat<'a> { || self.typ == Chattype::VerifiedGroup) { error!(context, 0, "Cannot send to chat type #{}.", self.typ,); - } else if (self.typ == Chattype::Group || self.typ == Chattype::VerifiedGroup) + return Ok(0); + } + + if (self.typ == Chattype::Group || self.typ == Chattype::VerifiedGroup) && 0 == is_contact_in_chat(context, self.id, 1 as u32) { log_event!( @@ -267,7 +270,9 @@ impl<'a> Chat<'a> { 0, "Cannot send message; self not in group.", ); - } else { + return Ok(0); + } + { if let Some(from) = context.sql.get_config(context, "configured_addr") { let new_rfc724_mid = { let grpid = match self.typ {