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) => {