no more clones!

This commit is contained in:
philipp 2023-05-24 12:18:14 +02:00
parent 1c74d11e96
commit c91db80ce5
3 changed files with 3 additions and 4 deletions

View File

@ -79,10 +79,10 @@ WHERE day=?",
trip_type = TripType::find_by_id(db, trip_type_id).await; trip_type = TripType::find_by_id(db, trip_type_id).await;
} }
ret.push(PlannedEventWithUserAndTriptype { ret.push(PlannedEventWithUserAndTriptype {
planned_event: event.clone(),
cox_needed: event.planned_amount_cox > cox.len() as i64, cox_needed: event.planned_amount_cox > cox.len() as i64,
cox, cox,
rower: event.get_all_rower(db).await, rower: event.get_all_rower(db).await,
planned_event: event,
trip_type, trip_type,
}); });
} }

View File

@ -113,9 +113,9 @@ ORDER BY name
//been deleted //been deleted
} }
match user.pw.clone() { match user.pw.as_ref() {
Some(user_pw) => { Some(user_pw) => {
let password_hash = Self::get_hashed_pw(&pw); let password_hash = &Self::get_hashed_pw(&pw);
if password_hash == user_pw { if password_hash == user_pw {
return Ok(user); return Ok(user);
} }

View File

@ -98,7 +98,6 @@ async fn create(
_admin: AdminUser, _admin: AdminUser,
) -> Flash<Redirect> { ) -> Flash<Redirect> {
if User::create(db, data.name, data.is_guest).await { if User::create(db, data.name, data.is_guest).await {
//TODO: fix clone() above
Flash::success(Redirect::to("/admin/user"), "Successfully created user") Flash::success(Redirect::to("/admin/user"), "Successfully created user")
} else { } else {
Flash::error( Flash::error(