forked from Ruderverein-Donau-Linz/rowt
clean code with clippy
This commit is contained in:
parent
b92a8fbde3
commit
daf8afd731
@ -168,7 +168,7 @@ FROM user_trip WHERE trip_details_id = (SELECT trip_details_id FROM trip WHERE i
|
|||||||
trip_id: i64,
|
trip_id: i64,
|
||||||
) -> Result<(), TripDeleteError> {
|
) -> Result<(), TripDeleteError> {
|
||||||
let registered_rower = Self::get_all_rower_for_id(db, trip_id).await;
|
let registered_rower = Self::get_all_rower_for_id(db, trip_id).await;
|
||||||
if registered_rower.len() > 0 {
|
if registered_rower.is_empty() {
|
||||||
return Err(TripDeleteError::SomebodyAlreadyRegistered);
|
return Err(TripDeleteError::SomebodyAlreadyRegistered);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@ impl User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> {
|
pub async fn find_by_id(db: &SqlitePool, id: i32) -> Option<Self> {
|
||||||
Some(
|
|
||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
User,
|
User,
|
||||||
"
|
"
|
||||||
@ -67,12 +66,10 @@ WHERE id like ?
|
|||||||
)
|
)
|
||||||
.fetch_one(db)
|
.fetch_one(db)
|
||||||
.await
|
.await
|
||||||
.ok()?,
|
.ok()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn find_by_name(db: &SqlitePool, name: String) -> Option<Self> {
|
async fn find_by_name(db: &SqlitePool, name: String) -> Option<Self> {
|
||||||
Some(
|
|
||||||
sqlx::query_as!(
|
sqlx::query_as!(
|
||||||
User,
|
User,
|
||||||
"
|
"
|
||||||
@ -84,8 +81,7 @@ WHERE name like ?
|
|||||||
)
|
)
|
||||||
.fetch_one(db)
|
.fetch_one(db)
|
||||||
.await
|
.await
|
||||||
.ok()?,
|
.ok()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_hashed_pw(pw: &str) -> String {
|
fn get_hashed_pw(pw: &str) -> String {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user