From 0cdfefe02d7ade0744adb1bd44796e48440ea52a Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Thu, 2 Aug 2018 13:57:55 +0200 Subject: Fix clippy issues. --- src/controllers/posts_controller.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/controllers/posts_controller.rs') diff --git a/src/controllers/posts_controller.rs b/src/controllers/posts_controller.rs index 99ff651..781f9f5 100644 --- a/src/controllers/posts_controller.rs +++ b/src/controllers/posts_controller.rs @@ -1,3 +1,4 @@ +#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] use comrak::{markdown_to_html, ComrakOptions}; use models::{NewPost, Post}; use rocket::{ @@ -28,7 +29,7 @@ fn new(_conn: DbConn) -> Page { #[post("/create", data = "")] fn create(post: Form, conn: DbConn) -> Flash { - Post::create(post.get(), conn); + Post::create(post.get(), &conn); Flash::success(Redirect::to("/"), "Post successfully created!") } @@ -48,7 +49,7 @@ impl ShowPostTemplate { #[get("/", format = "text/html")] fn show(id: i32, conn: DbConn) -> Page { - let p = Post::get(id, conn); + let p = Post::get(id, &conn); Page { title: p.title.clone(), flash: None, @@ -66,7 +67,7 @@ implement_responder_for!(EditPostTemplate); #[get("//edit", format = "text/html")] fn edit(id: i32, conn: DbConn) -> Page { - let p = Post::get(id, conn); + let p = Post::get(id, &conn); Page { title: String::from("Edit post"), flash: None, @@ -76,13 +77,13 @@ fn edit(id: i32, conn: DbConn) -> Page { #[post("/update", data = "")] fn update(post: Form, conn: DbConn) -> Flash { - Post::update(post.get(), conn); + Post::update(post.get(), &conn); Flash::success(Redirect::to("/"), "Post updated successfully!") } #[get("//delete", format = "text/html")] fn delete(id: i32, conn: DbConn) -> Flash { - Post::delete(id, conn); + Post::delete(id, &conn); Flash::success(Redirect::to("/"), "Post deleted!") } -- cgit v1.2.3