clean code with clippy
This commit is contained in:
		| @@ -131,11 +131,8 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i | ||||
|         .fetch_one(db) | ||||
|         .await | ||||
|         .unwrap(); //TODO: fixme | ||||
|         let trip_details_id = match trip_details.id { | ||||
|             Some(id) => id, | ||||
|             None => { | ||||
|         let Some(trip_details_id) = trip_details.id else { | ||||
|                 return Err(TripUpdateError::TripDoesNotExist); | ||||
|             } | ||||
|         }; | ||||
|  | ||||
|         sqlx::query!( | ||||
| @@ -152,14 +149,14 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i | ||||
|     } | ||||
|  | ||||
|     pub async fn delete_by_planned_event_id(db: &SqlitePool, user_id: i64, planned_event_id: i64) { | ||||
|         let _ = sqlx::query!( | ||||
|         sqlx::query!( | ||||
|             "DELETE FROM trip WHERE cox_id = ? AND planned_event_id = ?", | ||||
|             user_id, | ||||
|             planned_event_id | ||||
|         ) | ||||
|         .execute(db) | ||||
|         .await | ||||
|         .is_ok(); | ||||
|         .unwrap(); //TODO: fixme | ||||
|     } | ||||
|  | ||||
|     pub(crate) async fn delete( | ||||
|   | ||||
| @@ -99,11 +99,8 @@ ORDER BY name | ||||
|     } | ||||
|  | ||||
|     pub async fn login(db: &SqlitePool, name: String, pw: String) -> Result<Self, LoginError> { | ||||
|         let user = match User::find_by_name(db, name).await { | ||||
|             Some(user) => user, | ||||
|             None => { | ||||
|                 return Err(LoginError::InvalidAuthenticationCombo); // Username not found | ||||
|             } | ||||
|         let Some(user) = User::find_by_name(db, name).await else { | ||||
|             return Err(LoginError::InvalidAuthenticationCombo); // Username not found | ||||
|         }; | ||||
|  | ||||
|         match user.pw.clone() { | ||||
|   | ||||
| @@ -10,7 +10,7 @@ impl UserTrip { | ||||
|         user_id: i64, | ||||
|         trip_details_id: i64, | ||||
|     ) -> Result<(), UserTripError> { | ||||
|         let trip_details = TripDetails::find_by_id(&db, trip_details_id) | ||||
|         let trip_details = TripDetails::find_by_id(db, trip_details_id) | ||||
|             .await | ||||
|             .ok_or(UserTripError::TripDetailsNotFound)?; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user