clean code with clippy

This commit is contained in:
2023-04-04 19:49:27 +02:00
parent ed1ee2e7e2
commit da31c36c70
10 changed files with 33 additions and 52 deletions

View File

@ -27,7 +27,7 @@ async fn create(
_admin: AdminUser,
) -> Flash<Redirect> {
//TODO: fix clones()
let trip_details_id = TripDetails::new(
let trip_details_id = TripDetails::create(
db,
data.planned_starting_time.clone(),
data.max_people,
@ -37,7 +37,7 @@ async fn create(
.await;
//TODO: fix clone()
PlannedEvent::new(
PlannedEvent::create(
db,
data.name.clone(),
data.planned_amount_cox,

View File

@ -44,14 +44,11 @@ async fn update(
_admin: AdminUser,
) -> Flash<Redirect> {
let user = User::find_by_id(db, data.id).await;
let user = match user {
Ok(user) => user,
Err(_) => {
let Ok(user) = user else {
return Flash::error(
Redirect::to("/admin/user"),
format!("User with ID {} does not exist!", data.id),
)
}
};
user.update(db, data.is_cox, data.is_admin, data.is_guest)