more clippy :-)

This commit is contained in:
2023-07-25 13:32:20 +02:00
parent a7789af713
commit e5f22ae070
5 changed files with 32 additions and 37 deletions

View File

@ -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);