cargo clippy

This commit is contained in:
Philipp Hofer 2025-04-21 15:14:42 +02:00
parent 4a0f6c0285
commit d57fd670b3
6 changed files with 11 additions and 12 deletions

View File

@ -154,7 +154,7 @@ DROP TABLE temp_pos;",
self.stations(db) self.stations(db)
.await .await
.into_iter() .into_iter()
.filter(|s| s.crewless()) .filter(Station::crewless)
.collect() .collect()
} }

View File

@ -450,10 +450,10 @@ AND r.left_at IS NOT NULL;",
let missing_teams: Vec<Team> = stream::iter(teams) let missing_teams: Vec<Team> = stream::iter(teams)
.filter_map(|entry| async move { .filter_map(|entry| async move {
if !entry.been_at_station(db, &self).await { if entry.been_at_station(db, self).await {
Some(entry)
} else {
None None
} else {
Some(entry)
} }
}) })
.collect() .collect()

View File

@ -525,7 +525,7 @@ async fn quick_post(
let mut ret = String::new(); let mut ret = String::new();
let mut amount_succ = 0; let mut amount_succ = 0;
for (team_id, points) in form.fields.iter() { for (team_id, points) in &form.fields {
let Ok(team_id) = team_id.parse::<i64>() else { let Ok(team_id) = team_id.parse::<i64>() else {
ret.push_str(&format!( ret.push_str(&format!(
"Skipped team_id={team_id} because this id can't be parsed as i64" "Skipped team_id={team_id} because this id can't be parsed as i64"

View File

@ -230,7 +230,7 @@ impl Team {
} }
pub async fn been_at_station(&self, db: &SqlitePool, station: &Station) -> bool { pub async fn been_at_station(&self, db: &SqlitePool, station: &Station) -> bool {
Rating::find_by_team_and_station(db, &self, station) Rating::find_by_team_and_station(db, self, station)
.await .await
.is_some() .is_some()
} }

View File

@ -66,7 +66,7 @@ async fn create(
} }
}; };
Redirect::to(&format!("/admin/team/{}", id)) Redirect::to(&format!("/admin/team/{id}"))
} }
async fn delete( async fn delete(
@ -119,7 +119,7 @@ async fn quick(db: Arc<SqlitePool>, team: &Team, stations: Vec<Station>, redirec
} }
} }
td { td {
@if let Some(rating) = Rating::find_by_team_and_station(&db, &team, station).await { @if let Some(rating) = Rating::find_by_team_and_station(&db, team, station).await {
a href=(format!("/s/{}/{}", station.id, station.pw)){ a href=(format!("/s/{}/{}", station.id, station.pw)){
@if let Some(points) = rating.points { @if let Some(points) = rating.points {
em data-tooltip="Schon eingetragen" { em data-tooltip="Schon eingetragen" {
@ -208,7 +208,7 @@ async fn quick_post(
let mut ret = String::new(); let mut ret = String::new();
let mut amount_succ = 0; let mut amount_succ = 0;
for (station_id, points) in form.fields.iter() { for (station_id, points) in &form.fields {
let Ok(station_id) = station_id.parse::<i64>() else { let Ok(station_id) = station_id.parse::<i64>() else {
ret.push_str(&format!( ret.push_str(&format!(
"Skipped stationid={station_id} because this id can't be parsed as i64" "Skipped stationid={station_id} because this id can't be parsed as i64"
@ -217,8 +217,7 @@ async fn quick_post(
}; };
let Ok(points) = points.parse::<i64>() else { let Ok(points) = points.parse::<i64>() else {
ret.push_str(&format!( ret.push_str(&format!(
"Skipped stationid={station_id} because points {} can't be parsed as i64", "Skipped stationid={station_id} because points {points} can't be parsed as i64",
points
)); ));
continue; continue;
}; };

View File

@ -37,7 +37,7 @@ async fn create(
} }
}; };
Redirect::to(&format!("/admin/user/{}", id)) Redirect::to(&format!("/admin/user/{id}"))
} }
async fn delete( async fn delete(