diff --git a/archive-http/src/main.rs b/archive-http/src/main.rs index 1b4cad8..5d28609 100644 --- a/archive-http/src/main.rs +++ b/archive-http/src/main.rs @@ -54,14 +54,10 @@ impl<'a> Into> for (&'a DbVal, &'a Database) { let posts = db.list_posts(list.pk, None).unwrap(); ListTemplate { title: &list.name, - list: &list, + list, posts, months, - body: &list - .description - .as_ref() - .map(|s| s.as_str()) - .unwrap_or_default(), + body: list.description.as_deref().unwrap_or_default(), } } } @@ -141,7 +137,7 @@ async fn main() { title: "mailing list archive", description: "", lists_len: lists.len(), - lists: lists, + lists, }; let res = template.render().unwrap(); Ok(warp::reply::html(res)) diff --git a/cli/src/main.rs b/cli/src/main.rs index 558d7a6..4c89e3b 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -664,10 +664,8 @@ fn run_app(opt: Opt) -> Result<()> { hasher.finish() } let mut buf = Vec::with_capacity(4096); - let files = melib::backends::maildir::MaildirType::list_mail_in_maildir_fs( - maildir_path.clone(), - true, - )?; + let files = + melib::backends::maildir::MaildirType::list_mail_in_maildir_fs(maildir_path, true)?; let mut ctr = 0; for file in files { let hash = get_file_hash(&file); diff --git a/core/src/config.rs b/core/src/config.rs index c1c215a..7722ba7 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -92,8 +92,7 @@ impl Configuration { } if path.starts_with("~") { path = Path::new(&std::env::var("HOME").context("No $HOME set.")?) - .join(path.strip_prefix("~").context("Internal error while getting default database path: path starts with ~ but rust couldn't strip_refix(\"~\"")?) - .into(); + .join(path.strip_prefix("~").context("Internal error while getting default database path: path starts with ~ but rust couldn't strip_refix(\"~\"")?); } let config: Configuration = Self::from_file(&path)?; config.init_with() @@ -110,8 +109,7 @@ impl Configuration { xdg::BaseDirectories::with_prefix("mailpot")?.place_config_file("config.toml")?; if result.starts_with("~") { result = Path::new(&std::env::var("HOME").context("No $HOME set.")?) - .join(result.strip_prefix("~").context("Internal error while getting default database path: path starts with ~ but rust couldn't strip_refix(\"~\"")?) - .into(); + .join(result.strip_prefix("~").context("Internal error while getting default database path: path starts with ~ but rust couldn't strip_refix(\"~\"")?); } Ok(result) } diff --git a/core/src/db/posts.rs b/core/src/db/posts.rs index 6c7dd40..48f5842 100644 --- a/core/src/db/posts.rs +++ b/core/src/db/posts.rs @@ -160,21 +160,20 @@ impl Database { if !recipients.is_empty() { trace!("recipients: {:?}", &recipients); - match &configuration.send_mail { - crate::config::SendMail::Smtp(ref smtp_conf) => { - let smtp_conf = smtp_conf.clone(); - use melib::futures; - use melib::smol; - use melib::smtp::*; - let mut conn = smol::future::block_on(smol::spawn( - SmtpConnection::new_connection(smtp_conf.clone()), - ))?; - futures::executor::block_on(conn.mail_transaction( - &String::from_utf8_lossy(&bytes), - Some(recipients), - ))?; - } - _ => {} + if let crate::config::SendMail::Smtp(ref smtp_conf) = + &configuration.send_mail + { + let smtp_conf = smtp_conf.clone(); + use melib::futures; + use melib::smol; + use melib::smtp::*; + let mut conn = smol::future::block_on(smol::spawn( + SmtpConnection::new_connection(smtp_conf.clone()), + ))?; + futures::executor::block_on(conn.mail_transaction( + &String::from_utf8_lossy(&bytes), + Some(recipients), + ))?; } } else { trace!("list has no recipients"); diff --git a/core/src/mail/message_filters.rs b/core/src/mail/message_filters.rs index 59ccbd5..0c50825 100644 --- a/core/src/mail/message_filters.rs +++ b/core/src/mail/message_filters.rs @@ -16,6 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ +#![allow(clippy::result_unit_err)] use super::*; diff --git a/core/src/models.rs b/core/src/models.rs index ab622c2..413a1bd 100644 --- a/core/src/models.rs +++ b/core/src/models.rs @@ -77,7 +77,7 @@ where } } -#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)] pub struct MailingList { pub pk: i64, pub name: String,