improve code with clippy

This commit is contained in:
philipp 2023-11-02 22:19:13 +01:00
parent 1b58641100
commit 9331b2001d
2 changed files with 6 additions and 8 deletions

View File

@ -124,7 +124,7 @@ pub enum LogbookCreateError {
impl From<LogbookUpdateError> for LogbookCreateError {
fn from(value: LogbookUpdateError) -> Self {
return match value {
match value {
LogbookUpdateError::NotYourEntry => LogbookCreateError::NotYourEntry,
LogbookUpdateError::TooManyRowers(a, b) => LogbookCreateError::TooManyRowers(a, b),
LogbookUpdateError::RowerCreateError(a, b) => {
@ -140,7 +140,7 @@ impl From<LogbookUpdateError> for LogbookCreateError {
LogbookUpdateError::UserNotAllowedToUseBoat => {
LogbookCreateError::UserNotAllowedToUseBoat
}
};
}
}
}
@ -429,7 +429,7 @@ ORDER BY departure DESC
return Err(LogbookUpdateError::SteeringPersonNotInRowers);
}
if !boat.shipmaster_allowed(&user).await && self.shipmaster != user.id {
if !boat.shipmaster_allowed(user).await && self.shipmaster != user.id {
//second part:
//shipmaster has
//entered a

View File

@ -217,12 +217,10 @@ async fn create_kiosk(
User::find_by_id(db, boat.owner.unwrap() as i32)
.await
.unwrap()
} else if let Some(shipmaster) = data.shipmaster {
User::find_by_id(db, shipmaster as i32).await.unwrap()
} else {
if let Some(shipmaster) = data.shipmaster {
User::find_by_id(db, shipmaster as i32).await.unwrap()
} else {
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
}
User::find_by_id(db, data.rowers[0] as i32).await.unwrap()
};
Log::create(
db,