From b7bca3e4555a355db9239be0ffb10ef2049b3912 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Mon, 25 Nov 2019 17:42:57 -0600 Subject: [PATCH] removed a single use variable --- src/main.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index b968e59..67fd0ab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,14 +87,12 @@ fn show_post(title: String) -> Template { let title_splited: Vec<&str> = title.split('-').collect(); let id = title_splited.last().unwrap().parse().unwrap(); - let post = get_post(id); + match get_post(id) { + Ok(mut post) => { + let content = markdown_to_html(&post.content, &ComrakOptions::default()); + post.content = content; - match post { - Ok(mut p) => { - let content = markdown_to_html(&p.content, &ComrakOptions::default()); - p.content = content; - - context.insert("post", &p); + context.insert("post", &post); Template::render("post", context) } Err(_e) => {