From 9a6b7f8685e0f355ce0fdcd5e318903a039101f0 Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 24 Aug 2024 01:34:41 +0200 Subject: [PATCH] more cleanup & fixes --- src/email.rs | 15 ++++++++------- src/main.rs | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/email.rs b/src/email.rs index 5cc3915..790fe1f 100644 --- a/src/email.rs +++ b/src/email.rs @@ -107,13 +107,14 @@ impl Email { email = email.to(recipient.parse().unwrap()); } email = email.message_id(Some(message_id.clone())); - let email = - if let Some(in_reply_to) = in_reply_to { email.in_reply_to(in_reply_to) } else { email } - .subject(subject) - .singlepart( - SinglePart::builder().header(header::ContentType::TEXT_PLAIN).body(body), - ) - .unwrap(); + let email = if let Some(in_reply_to) = in_reply_to { + email.in_reply_to(in_reply_to) + } else { + email + } + .subject(subject) + .singlepart(SinglePart::builder().header(header::ContentType::TEXT_PLAIN).body(body)) + .unwrap(); if !self.is_dry_run { let mailer = SmtpTransport::starttls_relay(&self.server)? diff --git a/src/main.rs b/src/main.rs index e4f3707..e43ac98 100644 --- a/src/main.rs +++ b/src/main.rs @@ -345,9 +345,9 @@ fn main() -> Result<(), Box> { // shutdown config.set("state-last-run", &today.to_string())?; if config.has_errors() { - return Err("There were errors while writing config values.".into()); + Err("There were errors while writing config values.".into()) } else { - return Ok(()); + Ok(()) } } @@ -516,7 +516,7 @@ fn do_reminder( }; let body_prefix = if old_toc == toc { format!("Die Themen sind gleich geblieben. ") - } else if toc.is_empty() { + } else if old_toc.is_empty() { format!("Es gibt Themen, die aktuelle Liste ist:\n\n{toc}\n\n") } else { format!("Es gab nochmal Änderungen, die aktualisierten Themen für das Plenum sind:\n\n{toc}\n\n") @@ -554,7 +554,7 @@ fn do_protocol( wiki: &Mediawiki, ) -> Result<(), Box> { let (current_pad_id, pad_content, toc, n_topics) = get_pad_info(config, hedgedoc); - if toc.len() > 0 { + if !toc.is_empty() { let human_date = plenum_day.format("%d.%m.%Y"); let pad_content = hedgedoc::strip_metadata(pad_content); let subject = format!("Protokoll vom Plenum am {human_date}");