more clippy :-)
This commit is contained in:
@ -101,7 +101,7 @@ impl Logbook {
|
||||
boat: Boat::find_by_id(db, log.boat_id as i32).await.unwrap(),
|
||||
shipmaster_user: User::find_by_id(db, log.shipmaster as i32).await.unwrap(),
|
||||
logbook: log,
|
||||
})
|
||||
});
|
||||
}
|
||||
ret
|
||||
}
|
||||
@ -127,18 +127,15 @@ impl Logbook {
|
||||
boat: Boat::find_by_id(db, log.boat_id as i32).await.unwrap(),
|
||||
shipmaster_user: User::find_by_id(db, log.shipmaster as i32).await.unwrap(),
|
||||
logbook: log,
|
||||
})
|
||||
});
|
||||
}
|
||||
ret
|
||||
}
|
||||
|
||||
pub async fn create(db: &SqlitePool, log: LogToAdd) -> Result<(), LogbookCreateError> {
|
||||
let boat = match Boat::find_by_id(db, log.boat_id).await {
|
||||
Some(b) => b,
|
||||
None => {
|
||||
return Err(LogbookCreateError::BoatNotFound);
|
||||
}
|
||||
};
|
||||
let Some(boat) = Boat::find_by_id(db, log.boat_id).await else {
|
||||
return Err(LogbookCreateError::BoatNotFound);
|
||||
};
|
||||
|
||||
if boat.is_locked(db).await {
|
||||
return Err(LogbookCreateError::BoatLocked);
|
||||
|
Reference in New Issue
Block a user