1
Fork 0
mirror of https://github.com/RGBCube/Site synced 2025-08-01 13:37:49 +00:00

Apply clippy suggestions

This commit is contained in:
RGBCube 2024-01-08 13:25:07 +03:00
parent 9a292fce5b
commit 083de2381a
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ pub enum Page {
} }
impl Page { impl Page {
pub fn as_str(self) -> &'static str { pub fn as_str(&self) -> &'static str {
match self { match self {
Self::Home => "home", Self::Home => "home",
Self::About => "about", Self::About => "about",

View file

@ -54,7 +54,7 @@ pub static PAGES: LazyLock<HashMap<String, (Metadata, Markup)>> = LazyLock::new(
log::info!("Adding page {path}"); log::info!("Adding page {path}");
pages.insert( pages.insert(
path.to_string().strip_suffix(".md").unwrap().to_string(), path.to_string().strip_suffix(".md").unwrap().to_string(),
(metadata, markdown::parse(&content)), (metadata, markdown::parse(content)),
); );
} }
@ -63,7 +63,7 @@ pub static PAGES: LazyLock<HashMap<String, (Metadata, Markup)>> = LazyLock::new(
pub async fn handler(Path(path): Path<String>) -> Markup { pub async fn handler(Path(path): Path<String>) -> Markup {
if let Some((metadata, body)) = PAGES.get(&path) { if let Some((metadata, body)) = PAGES.get(&path) {
text::create(Some(&metadata.title), Page::from_str(&path), &body) text::create(Some(&metadata.title), Page::from_str(&path), body)
} else { } else {
not_found::handler().await not_found::handler().await
} }