From 69680f227c97373aa61d853cfa29c5ea89a95485 Mon Sep 17 00:00:00 2001 From: Adrian Hedqvist Date: Sun, 18 Jun 2023 11:46:49 +0200 Subject: [PATCH] cargo clippy --fix && cargo fmt --- src/markdown.rs | 3 +-- src/post.rs | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/markdown.rs b/src/markdown.rs index bc567cf..3db098c 100644 --- a/src/markdown.rs +++ b/src/markdown.rs @@ -19,8 +19,7 @@ pub fn render_markdown_to_html(markdown: &str) -> Result { Event::Text(text) => { if code_block { code_accumulator.push_str(&text); - } - else { + } else { events.push(Event::Text(text)); } } diff --git a/src/post.rs b/src/post.rs index 580e81e..6571a81 100644 --- a/src/post.rs +++ b/src/post.rs @@ -4,14 +4,14 @@ use chrono::{DateTime, FixedOffset}; use glob::glob; use lazy_static::lazy_static; -use pulldown_cmark::{html, Options, Parser}; + use regex::Regex; use serde_derive::{Deserialize, Serialize}; use tokio::fs; use tracing::{instrument, log::*}; -use crate::{AppState, WebsiteError, markdown}; +use crate::{markdown, AppState, WebsiteError}; #[derive(Deserialize, Debug, Default)] pub struct TomlFrontMatter { @@ -102,9 +102,9 @@ 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) - }).transpose()?; + let content = content + .map(|c| markdown::render_markdown_to_html(&c)) + .transpose()?; Ok(Post::new( slug.to_string(),