diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-08-01 14:29:50 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-08-01 19:40:57 +0200 |
commit | b9bce0c426ab258f2c5891ac7eecd944f749e27c (patch) | |
tree | 3981bc54a4b0602d918ea378bc0847ea3a988633 /src/controllers/home_controller.rs | |
parent | d9a217e3b73a702875c2907d7d1811c3dd82d8e9 (diff) | |
download | rocket-blog-b9bce0c426ab258f2c5891ac7eecd944f749e27c.tar.gz rocket-blog-b9bce0c426ab258f2c5891ac7eecd944f749e27c.tar.bz2 rocket-blog-b9bce0c426ab258f2c5891ac7eecd944f749e27c.zip |
Run rustfmt on project.
Diffstat (limited to 'src/controllers/home_controller.rs')
-rw-r--r-- | src/controllers/home_controller.rs | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/controllers/home_controller.rs b/src/controllers/home_controller.rs index fb88d07..ba2ea0c 100644 --- a/src/controllers/home_controller.rs +++ b/src/controllers/home_controller.rs @@ -1,21 +1,14 @@ use models::Post; -use utils::{ - DbConn, - Page -}; -use rocket::{ - response::NamedFile, - request::FlashMessage, - Route -}; +use posts_controller::ShowPostTemplate; +use rocket::{request::FlashMessage, response::NamedFile, Route}; use rocket_contrib::Json; use std::path::PathBuf; -use posts_controller::ShowPostTemplate; +use utils::{DbConn, Page}; #[derive(BartDisplay)] #[template = "templates/index.html"] struct IndexTemplate { - posts: Vec<ShowPostTemplate> + posts: Vec<ShowPostTemplate>, } implement_responder_for!(IndexTemplate); @@ -26,10 +19,11 @@ fn index(flash: Option<FlashMessage>, conn: DbConn) -> Page<IndexTemplate> { title: String::from("Bloggen"), flash: flash, content: IndexTemplate { - posts: Post::get_all(conn).into_iter() + posts: Post::get_all(conn) + .into_iter() .map(|p| ShowPostTemplate { post: p }) - .collect() - } + .collect(), + }, } } @@ -47,9 +41,5 @@ fn public_file(file: PathBuf) -> Option<NamedFile> { } pub fn routes() -> Vec<Route> { - routes![ - index, - index_json, - public_file - ] + routes![index, index_json, public_file] } |