diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 4af681e..15496b7 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -15,7 +15,10 @@ use lazy_static::lazy_static; use prometheus::{opts, Encoder, IntCounterVec, TextEncoder}; use std::sync::Arc; use tower_http::services::ServeFile; -use tracing::{instrument, log::{error, info}}; +use tracing::{ + instrument, + log::{error, info}, +}; use crate::{AppState, WebsiteError}; @@ -62,13 +65,12 @@ pub async fn index( error!("Failed rendering index: {}", e); WebsiteError::NotFound })?; - Ok( - ( - StatusCode::OK, - [(header::LAST_MODIFIED, state.startup_time.to_rfc2822())], - Html(res) - ).into_response() + Ok(( + StatusCode::OK, + [(header::LAST_MODIFIED, state.startup_time.to_rfc2822())], + Html(res), ) + .into_response()) } async fn healthcheck() -> &'static str { diff --git a/src/handlers/posts.rs b/src/handlers/posts.rs index 7d94901..cbe81cf 100644 --- a/src/handlers/posts.rs +++ b/src/handlers/posts.rs @@ -88,7 +88,10 @@ pub async fn index( StatusCode::OK, [( header::LAST_MODIFIED, - last_changed.map_or_else(|| chrono::offset::Utc::now().to_rfc2822(), |d| d.to_rfc2822()), + last_changed.map_or_else( + || chrono::offset::Utc::now().to_rfc2822(), + |d| d.to_rfc2822(), + ), )], Html(res), ) @@ -120,7 +123,10 @@ pub async fn view( StatusCode::OK, [( header::LAST_MODIFIED, - last_changed.map_or_else(|| chrono::offset::Utc::now().to_rfc2822(), |d| d.to_rfc2822()), + last_changed.map_or_else( + || chrono::offset::Utc::now().to_rfc2822(), + |d| d.to_rfc2822(), + ), )], Html(res), ) @@ -149,7 +155,10 @@ pub async fn feed( (CONTENT_TYPE, "application/atom+xml"), ( header::LAST_MODIFIED, - &last_changed.map_or_else(|| chrono::offset::Utc::now().to_rfc2822(), |d| d.to_rfc2822()), + &last_changed.map_or_else( + || chrono::offset::Utc::now().to_rfc2822(), + |d| d.to_rfc2822(), + ), ), ], crate::feed::render_atom_feed(&state)?, diff --git a/src/handlers/tags.rs b/src/handlers/tags.rs index d2481c2..eb181f5 100644 --- a/src/handlers/tags.rs +++ b/src/handlers/tags.rs @@ -6,7 +6,10 @@ use axum::{ routing::get, Router, }; -use hyper::{header::{CONTENT_TYPE, self}, HeaderMap, StatusCode}; +use hyper::{ + header::{self, CONTENT_TYPE}, + HeaderMap, StatusCode, +}; use serde_derive::Serialize; use tracing::instrument; @@ -42,8 +45,9 @@ pub async fn index(State(state): State>) -> Result) -> Span { .map(axum::extract::MatchedPath::as_str) .unwrap_or_default(); let method = request.method().as_str(); - let target = uri.path_and_query().map(axum::http::uri::PathAndQuery::as_str).unwrap_or_default(); + let target = uri + .path_and_query() + .map(axum::http::uri::PathAndQuery::as_str) + .unwrap_or_default(); let name = format!("{method} {route}"); diff --git a/src/post.rs b/src/post.rs index e4e7a57..984f70b 100644 --- a/src/post.rs +++ b/src/post.rs @@ -9,7 +9,10 @@ use regex::Regex; use serde_derive::{Deserialize, Serialize}; use tokio::fs; -use tracing::{instrument, log::{debug, warn}}; +use tracing::{ + instrument, + log::{debug, warn}, +}; use crate::{markdown, AppState, WebsiteError}; @@ -106,8 +109,7 @@ pub async fn load_post(slug: &str) -> color_eyre::eyre::Result { let (tomlfm, content) = parse_frontmatter(content)?; let tomlfm = tomlfm.expect("Missing frontmatter"); - let content = content - .map(|c| markdown::render_markdown_to_html(&c)); + let content = content.map(|c| markdown::render_markdown_to_html(&c)); Ok(Post::new( slug.to_string(), @@ -143,7 +145,10 @@ pub async fn render_post(state: &AppState, post: &Post) -> Result