removed a single use variable
parent
11e183504d
commit
b7bca3e455
12
src/main.rs
12
src/main.rs
|
@ -87,14 +87,12 @@ fn show_post(title: String) -> Template {
|
||||||
let title_splited: Vec<&str> = title.split('-').collect();
|
let title_splited: Vec<&str> = title.split('-').collect();
|
||||||
let id = title_splited.last().unwrap().parse().unwrap();
|
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 {
|
context.insert("post", &post);
|
||||||
Ok(mut p) => {
|
|
||||||
let content = markdown_to_html(&p.content, &ComrakOptions::default());
|
|
||||||
p.content = content;
|
|
||||||
|
|
||||||
context.insert("post", &p);
|
|
||||||
Template::render("post", context)
|
Template::render("post", context)
|
||||||
}
|
}
|
||||||
Err(_e) => {
|
Err(_e) => {
|
||||||
|
|
Loading…
Reference in New Issue