From c91db80ce5d0eff2f03fca60b9180c04b0c1c003 Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 24 May 2023 12:18:14 +0200 Subject: [PATCH] no more clones! --- src/model/planned_event.rs | 2 +- src/model/user.rs | 4 ++-- src/rest/admin/user.rs | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/model/planned_event.rs b/src/model/planned_event.rs index 5a024e8..829cc11 100644 --- a/src/model/planned_event.rs +++ b/src/model/planned_event.rs @@ -79,10 +79,10 @@ WHERE day=?", trip_type = TripType::find_by_id(db, trip_type_id).await; } ret.push(PlannedEventWithUserAndTriptype { - planned_event: event.clone(), cox_needed: event.planned_amount_cox > cox.len() as i64, cox, rower: event.get_all_rower(db).await, + planned_event: event, trip_type, }); } diff --git a/src/model/user.rs b/src/model/user.rs index d5fdc2b..9f3a94e 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -113,9 +113,9 @@ ORDER BY name //been deleted } - match user.pw.clone() { + match user.pw.as_ref() { Some(user_pw) => { - let password_hash = Self::get_hashed_pw(&pw); + let password_hash = &Self::get_hashed_pw(&pw); if password_hash == user_pw { return Ok(user); } diff --git a/src/rest/admin/user.rs b/src/rest/admin/user.rs index ec8f2a4..b4d9cd5 100644 --- a/src/rest/admin/user.rs +++ b/src/rest/admin/user.rs @@ -98,7 +98,6 @@ async fn create( _admin: AdminUser, ) -> Flash { if User::create(db, data.name, data.is_guest).await { - //TODO: fix clone() above Flash::success(Redirect::to("/admin/user"), "Successfully created user") } else { Flash::error(