Fix unused variables lint

pull/1/head
Manos Pitsidianakis 2022-05-14 08:47:51 +03:00
parent 8c7d342e9b
commit 69f62de3b5
2 changed files with 15 additions and 16 deletions

View File

@ -27,13 +27,12 @@ pub use mailpot::*;
use askama::Template; use askama::Template;
use percent_encoding::percent_decode_str; use percent_encoding::percent_decode_str;
use warp::reject;
#[derive(Template)] #[derive(Template)]
#[template(path = "list.html")] #[template(path = "list.html")]
struct ListTemplate<'a> { struct ListTemplate<'a> {
title: &'a str, title: &'a str,
list: &'a DbVal<MailingList>, _list: &'a DbVal<MailingList>,
posts: Vec<DbVal<Post>>, posts: Vec<DbVal<Post>>,
body: &'a str, body: &'a str,
} }
@ -42,14 +41,14 @@ struct ListTemplate<'a> {
#[template(path = "post.html")] #[template(path = "post.html")]
struct PostTemplate<'a> { struct PostTemplate<'a> {
title: &'a str, title: &'a str,
list: &'a DbVal<MailingList>, _list: &'a DbVal<MailingList>,
post: DbVal<Post>, _post: DbVal<Post>,
body: &'a str, body: &'a str,
from: &'a str, _from: &'a str,
to: &'a str, _to: &'a str,
subject: &'a str, subject: &'a str,
in_reply_to: Option<String>, _in_reply_to: Option<String>,
references: Vec<String>, _references: Vec<String>,
} }
use warp::Filter; use warp::Filter;
@ -61,7 +60,7 @@ async fn main() {
let posts = db.list_posts(list_pk, None).unwrap(); let posts = db.list_posts(list_pk, None).unwrap();
let template = ListTemplate { let template = ListTemplate {
title: &list.name, title: &list.name,
list: &list, _list: &list,
posts, posts,
body: &list.description.clone().unwrap_or_default(), body: &list.description.clone().unwrap_or_default(),
}; };
@ -84,14 +83,14 @@ async fn main() {
let body_text = body.text(); let body_text = body.text();
let template = PostTemplate { let template = PostTemplate {
title: &list.name, title: &list.name,
list: &list, _list: &list,
post, _post: post,
body: &body_text, body: &body_text,
from: &envelope.field_from_to_string(), _from: &envelope.field_from_to_string(),
to: &envelope.field_to_to_string(), _to: &envelope.field_to_to_string(),
subject: &envelope.subject(), subject: &envelope.subject(),
in_reply_to: envelope.in_reply_to_display().map(|r| r.to_string()), _in_reply_to: envelope.in_reply_to_display().map(|r| r.to_string()),
references: envelope _references: envelope
.references() .references()
.into_iter() .into_iter()
.map(|m| m.to_string()) .map(|m| m.to_string())

View File

@ -155,7 +155,7 @@ impl Database {
pub fn list_posts( pub fn list_posts(
&self, &self,
list_pk: i64, list_pk: i64,
date_range: Option<(String, String)>, _date_range: Option<(String, String)>,
) -> Result<Vec<DbVal<Post>>> { ) -> Result<Vec<DbVal<Post>>> {
let mut stmt = self let mut stmt = self
.connection .connection