more clippy :-)

This commit is contained in:
2023-07-25 13:32:20 +02:00
parent a7789af713
commit e5f22ae070
5 changed files with 32 additions and 37 deletions

View File

@ -31,19 +31,20 @@ pub struct Day {
impl Day {
pub async fn new(db: &SqlitePool, day: NaiveDate, is_pinned: bool) -> Self {
let planned_events = match is_pinned {
true => PlannedEvent::get_pinned_for_day(db, day).await,
false => PlannedEvent::get_for_day(db, day).await,
};
let trips = match is_pinned {
true => Trip::get_pinned_for_day(db, day).await,
false => Trip::get_for_day(db, day).await,
};
Self {
day,
planned_events,
trips,
is_pinned,
if is_pinned {
Self {
day,
planned_events: PlannedEvent::get_pinned_for_day(db, day).await,
trips: Trip::get_pinned_for_day(db, day).await,
is_pinned,
}
} else {
Self {
day,
planned_events: PlannedEvent::get_for_day(db, day).await,
trips: Trip::get_for_day(db, day).await,
is_pinned,
}
}
}
pub async fn new_guest(db: &SqlitePool, day: NaiveDate, is_pinned: bool) -> Self {