clean code with clippy

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

8
Cargo.lock generated
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -120,9 +120,9 @@ ORDER BY day;",
pub(crate) async fn user_allowed_to_change(&self, db: &SqlitePool, user: &User) -> bool {
if self.belongs_to_event(db).await {
return user.is_admin;
user.is_admin
} 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;
return Flash::success(Redirect::to("/"), "Erfolgreich abgemeldet!");
Flash::success(Redirect::to("/"), "Erfolgreich abgemeldet!")
}
Err(TripHelpDeleteError::DetailsLocked) => {
return Flash::error(Redirect::to("/"), "Boot bereits eingeteilt");
Flash::error(Redirect::to("/"), "Boot bereits eingeteilt")
}
Err(TripHelpDeleteError::CoxNotHelping) => {
return Flash::error(Redirect::to("/"), "Steuermann hilft nicht aus...")
Flash::error(Redirect::to("/"), "Steuermann hilft nicht aus...")
}
}
} else {