From 3832510760b93ce00269271d3f37a2540b920e63 Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Sat, 27 Feb 2021 21:09:00 +0100 Subject: [PATCH] refactor(api): pass by reference --- src/api.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api.rs b/src/api.rs index 1101265..1f72074 100644 --- a/src/api.rs +++ b/src/api.rs @@ -45,8 +45,8 @@ pub struct Response { message: Option, } -fn change_password(data: Json, - context: rocket::State) -> Result<()> { +fn change_password(data: &Json, + context: &rocket::State) -> Result<()> { let dn = Handlebars::new() .render_template(&context.dn, &json!({"username" : &data.username})) @@ -72,7 +72,7 @@ fn change_password(data: Json, pub fn update(data: Json, context: rocket::State) -> Json { Json( - match change_password(data, context) { + match change_password(&data, &context) { Ok(_) => Response{ success: true, message: None,