Fix some more clippy lints
Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
parent
90fd14b6d3
commit
4fafdd75d3
10
src/feed.rs
10
src/feed.rs
@ -11,8 +11,8 @@ use mail_parser::HeaderValue;
|
||||
pub(crate) fn add_entry_to_feed(
|
||||
feed: &mut Feed,
|
||||
message: &Message,
|
||||
processed_html: &String,
|
||||
hostname: &String,
|
||||
processed_html: &str,
|
||||
hostname: &str,
|
||||
include_html: bool,
|
||||
) {
|
||||
let parsed = message.get_parsed().unwrap();
|
||||
@ -39,7 +39,7 @@ pub(crate) fn add_entry_to_feed(
|
||||
uri: None,
|
||||
},
|
||||
title: parsed.subject().expect("Expected a subject").to_string(),
|
||||
content: Some(processed_html.clone()),
|
||||
content: Some(processed_html.to_owned()),
|
||||
id: url.clone(),
|
||||
published: Utc.timestamp_opt(date.to_timestamp(), 0).unwrap(),
|
||||
url: match include_html {
|
||||
@ -53,13 +53,13 @@ pub(crate) fn add_entry_to_feed(
|
||||
}
|
||||
|
||||
pub(crate) fn build_atom_feed(hostname: &String, feed_file: &str) -> Feed {
|
||||
let feed_url = format!("https://{}/{}", hostname, feed_file);
|
||||
let feed_url = format!("https://{hostname}/{feed_file}");
|
||||
FeedBuilder::default()
|
||||
.title("JJKiers Newsletters")
|
||||
.id(&feed_url)
|
||||
.link(
|
||||
LinkBuilder::default()
|
||||
.href(format!("https://{}/", hostname))
|
||||
.href(format!("https://{hostname}/"))
|
||||
.rel("alternate".to_string())
|
||||
.build(),
|
||||
)
|
||||
|
12
src/main.rs
12
src/main.rs
@ -1,4 +1,4 @@
|
||||
#[warn(missing_docs)]
|
||||
#[deny(missing_docs)]
|
||||
#[doc = include_str!("../README.md")]
|
||||
mod cli;
|
||||
mod command;
|
||||
@ -85,7 +85,7 @@ fn build_feed(
|
||||
.to_str()
|
||||
.expect("Feed path should be printable.");
|
||||
|
||||
let mut feed = feed::build_atom_feed(&hostname, feed_file);
|
||||
let mut feed = feed::build_atom_feed(hostname, feed_file);
|
||||
|
||||
let mut reader = DataDirectoryMessageReader::new(Path::new("data").to_path_buf());
|
||||
|
||||
@ -111,10 +111,10 @@ fn build_feed(
|
||||
|
||||
if include_html {
|
||||
let path: PathBuf = [dir, Path::new(&get_path(&parsed, &msg))].iter().collect();
|
||||
write_file(&path, processed_html.as_bytes())?;
|
||||
write_file(path, processed_html.as_bytes())?;
|
||||
}
|
||||
|
||||
feed::add_entry_to_feed(&mut feed, &msg, &processed_html, &hostname, include_html);
|
||||
feed::add_entry_to_feed(&mut feed, &msg, &processed_html, hostname, include_html);
|
||||
}
|
||||
|
||||
if !feed.entries.is_empty() {
|
||||
@ -143,7 +143,7 @@ fn fetch_from_imap(
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
create_directory(data_directory)?;
|
||||
|
||||
print!("Getting mail from {} for mailbox {}", server, username);
|
||||
print!("Getting mail from {server} for mailbox {username}");
|
||||
|
||||
let mut reader = ImapReader::new(server, port, username, password);
|
||||
|
||||
@ -170,7 +170,7 @@ fn fetch_from_imap(
|
||||
let path = get_path(&parsed, &msg);
|
||||
let html_path: PathBuf = [
|
||||
Path::new(data_directory),
|
||||
Path::new(&format!("{}.eml", path)),
|
||||
Path::new(&format!("{path}.eml")),
|
||||
]
|
||||
.iter()
|
||||
.collect();
|
||||
|
Loading…
Reference in New Issue
Block a user