Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(src): address clippy errors #156

Merged
merged 1 commit into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ pub fn all_pages(
match cache_file {
Ok(f) => {
let mut f = BufWriter::new(f);
println!("Writing string is {}", cache_expiry_time);
println!("Writing string is {cache_expiry_time}");
println!(
"Writing Expiry Time is {:#?}",
DateTime::parse_from_rfc3339(&cache_expiry_time)
);
// Cache_contents is stored in a file in the following manner
// Cache expiry timer on the 1st line
// The rest of the file contains the cache contents
writeln!(f, "{}", cache_expiry_time)?;
write!(f, "{}", cache_data)?;
writeln!(f, "{cache_expiry_time}")?;
write!(f, "{cache_data}")?;
}
_ => {
eprintln!("Cannot create Cache file");
Expand Down Expand Up @@ -175,7 +175,7 @@ pub fn all_pages_load(dir: PathBuf, show_unpublished: bool) -> anyhow::Result<In
.map(|f| f.to_string_lossy().starts_with('.'))
.unwrap_or(false)
{
eprintln!("Skipping dotfile {:?}", f);
eprintln!("Skipping dotfile {f:?}");
continue;
}
let raw_data = std::fs::read_to_string(&f)
Expand Down Expand Up @@ -374,7 +374,7 @@ impl Content {
.render_template(&self.body, &{})
.unwrap_or_else(|e| {
// print the error
eprintln!("Error rendering markdown: {}", e);
eprintln!("Error rendering markdown: {e}");
// return nothing
e.to_string()
});
Expand Down
4 changes: 2 additions & 2 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ enum ContentEncoding {
}

pub fn not_found(route: String, body: String) -> Result<Response> {
eprintln!("Not found: {}", route);
eprintln!("Not found: {route}");
let bldr = Builder::new()
.status(http::StatusCode::NOT_FOUND)
.header(http::header::CONTENT_TYPE, "text/html; charset=utf-8");
Expand All @@ -48,7 +48,7 @@ pub fn send_result(
content_encoding: Option<&HeaderValue>,
status: Option<u16>,
) -> Result<Response> {
eprintln!("Responded: {}", route);
eprintln!("Responded: {route}");
let mut bldr = Builder::new().header(http::header::CONTENT_TYPE, content_type);
if let Some(status) = status {
bldr = bldr.status(status);
Expand Down