clean code with clippy

This commit is contained in:
philipp 2023-09-06 14:39:36 +02:00
parent 16da28561e
commit 6e1bc101bf
7 changed files with 16 additions and 18 deletions

8
Cargo.lock generated
View File

@ -278,9 +278,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.28" version = "0.4.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" checksum = "d87d9d13be47a5b7c3907137f1290b0459a7f80efb26be8c52afb11963bccb02"
dependencies = [ dependencies = [
"android-tzdata", "android-tzdata",
"iana-time-zone", "iana-time-zone",
@ -2702,9 +2702,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.3.3" version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee"
dependencies = [ dependencies = [
"same-file", "same-file",
"winapi-util", "winapi-util",

View File

@ -109,7 +109,7 @@ impl Boat {
damage, damage,
on_water: boat.on_water(db).await, on_water: boat.on_water(db).await,
boat, boat,
}) });
} }
res res
} }

View File

@ -101,7 +101,7 @@ ORDER BY created_at DESC
user_fixed, user_fixed,
user_verified, user_verified,
boat_damage, boat_damage,
}) });
} }
res res
} }

View File

@ -226,9 +226,7 @@ ORDER BY departure DESC
for rower in &log.rower { for rower in &log.rower {
Rower::create(&mut tx, inserted_row.id, *rower) Rower::create(&mut tx, inserted_row.id, *rower)
.await .await
.map_err(|e| { .map_err(|e| LogbookCreateError::RowerCreateError(*rower, e.to_string()))?;
return LogbookCreateError::RowerCreateError(*rower, e.to_string());
})?;
} }
tx.commit().await.unwrap(); tx.commit().await.unwrap();
@ -300,9 +298,9 @@ ORDER BY departure DESC
self.remove_rowers(&mut tx).await; self.remove_rowers(&mut tx).await;
for rower in &log.rower { for rower in &log.rower {
Rower::create(&mut tx, self.id, *rower).await.map_err(|e| { Rower::create(&mut tx, self.id, *rower)
return LogbookUpdateError::RowerCreateError(*rower, e.to_string()); .await
})?; .map_err(|e| LogbookUpdateError::RowerCreateError(*rower, e.to_string()))?;
} }
tx.commit().await.unwrap(); tx.commit().await.unwrap();

View File

@ -39,7 +39,7 @@ WHERE id in (SELECT rower_id FROM rower WHERE logbook_id=?)
) )
.execute(db) .execute(db)
.await .await
.map_err(|e| return e.to_string())?; .map_err(|e| e.to_string())?;
Ok(()) Ok(())
} }

View File

@ -120,9 +120,9 @@ ORDER BY day;",
pub(crate) async fn user_allowed_to_change(&self, db: &SqlitePool, user: &User) -> bool { pub(crate) async fn user_allowed_to_change(&self, db: &SqlitePool, user: &User) -> bool {
if self.belongs_to_event(db).await { if self.belongs_to_event(db).await {
return user.is_admin; user.is_admin
} else { } else {
return self.user_is_cox(db, user).await != CoxAtTrip::No; self.user_is_cox(db, user).await != CoxAtTrip::No
} }
} }

View File

@ -145,13 +145,13 @@ async fn remove(db: &State<SqlitePool>, planned_event_id: i64, cox: CoxUser) ->
) )
.await; .await;
return Flash::success(Redirect::to("/"), "Erfolgreich abgemeldet!"); Flash::success(Redirect::to("/"), "Erfolgreich abgemeldet!")
} }
Err(TripHelpDeleteError::DetailsLocked) => { Err(TripHelpDeleteError::DetailsLocked) => {
return Flash::error(Redirect::to("/"), "Boot bereits eingeteilt"); Flash::error(Redirect::to("/"), "Boot bereits eingeteilt")
} }
Err(TripHelpDeleteError::CoxNotHelping) => { Err(TripHelpDeleteError::CoxNotHelping) => {
return Flash::error(Redirect::to("/"), "Steuermann hilft nicht aus...") Flash::error(Redirect::to("/"), "Steuermann hilft nicht aus...")
} }
} }
} else { } else {