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