clean code with clippy
This commit is contained in:
parent
7fcae95b02
commit
9c30cda326
@ -46,6 +46,6 @@ LIMIT 1000
|
|||||||
}
|
}
|
||||||
ret.push_str("</channel>");
|
ret.push_str("</channel>");
|
||||||
ret.push_str("</rss>");
|
ret.push_str("</rss>");
|
||||||
ret.replace("\n", "")
|
ret.replace('\n', "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,8 @@ impl Day {
|
|||||||
pub async fn new_guest(db: &SqlitePool, day: NaiveDate) -> Self {
|
pub async fn new_guest(db: &SqlitePool, day: NaiveDate) -> Self {
|
||||||
let mut day = Self::new(db, day).await;
|
let mut day = Self::new(db, day).await;
|
||||||
|
|
||||||
day.planned_events = day
|
day.planned_events.retain(|e| e.planned_event.allow_guests);
|
||||||
.planned_events
|
day.trips.retain(|t| t.trip.allow_guests);
|
||||||
.into_iter()
|
|
||||||
.filter(|e| e.planned_event.allow_guests)
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
day.trips = day
|
|
||||||
.trips
|
|
||||||
.into_iter()
|
|
||||||
.filter(|t| t.trip.allow_guests)
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
day
|
day
|
||||||
}
|
}
|
||||||
|
@ -220,8 +220,8 @@ X-WR-CALNAME:Ruderausfahrten"#,
|
|||||||
res.push_str(&format!("\nUID:{}@rudernlinz.at", event.id));
|
res.push_str(&format!("\nUID:{}@rudernlinz.at", event.id));
|
||||||
res.push_str(&format!(
|
res.push_str(&format!(
|
||||||
"\nDTSTART;TZID=Europe/Vienna:{}T{}00",
|
"\nDTSTART;TZID=Europe/Vienna:{}T{}00",
|
||||||
event.day.replace("-", ""),
|
event.day.replace('-', ""),
|
||||||
event.planned_starting_time.replace(":", "")
|
event.planned_starting_time.replace(':', "")
|
||||||
));
|
));
|
||||||
res.push_str(&format!("\nSUMMARY:{}", event.name));
|
res.push_str(&format!("\nSUMMARY:{}", event.name));
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ WHERE trip.id=?
|
|||||||
cox: &CoxUser,
|
cox: &CoxUser,
|
||||||
planned_event: &PlannedEvent,
|
planned_event: &PlannedEvent,
|
||||||
) -> Result<(), CoxHelpError> {
|
) -> Result<(), CoxHelpError> {
|
||||||
if planned_event.is_rower_registered(db, &cox).await {
|
if planned_event.is_rower_registered(db, cox).await {
|
||||||
return Err(CoxHelpError::AlreadyRegisteredAsRower);
|
return Err(CoxHelpError::AlreadyRegisteredAsRower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ ORDER BY name
|
|||||||
|
|
||||||
match user.pw.as_ref() {
|
match user.pw.as_ref() {
|
||||||
Some(user_pw) => {
|
Some(user_pw) => {
|
||||||
let password_hash = &Self::get_hashed_pw(&pw);
|
let password_hash = &Self::get_hashed_pw(pw);
|
||||||
if password_hash == user_pw {
|
if password_hash == user_pw {
|
||||||
return Ok(user);
|
return Ok(user);
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ ORDER BY name
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_pw(&self, db: &SqlitePool, pw: &str) {
|
pub async fn update_pw(&self, db: &SqlitePool, pw: &str) {
|
||||||
let pw = Self::get_hashed_pw(&pw);
|
let pw = Self::get_hashed_pw(pw);
|
||||||
sqlx::query!("UPDATE user SET pw = ? where id = ?", pw, self.id)
|
sqlx::query!("UPDATE user SET pw = ? where id = ?", pw, self.id)
|
||||||
.execute(db)
|
.execute(db)
|
||||||
.await
|
.await
|
||||||
|
Loading…
Reference in New Issue
Block a user