chore: apply clippy's suggestions
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/clippy Pipeline was successful Details
ci/woodpecker/push/build Pipeline was successful Details

bib-booking
Jef Roosens 2023-05-17 21:14:48 +02:00
parent 10140d879c
commit 180768b858
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
2 changed files with 6 additions and 9 deletions

View File

@ -57,7 +57,7 @@ impl Resource {
duration = duration + Duration::minutes(hour.granularity.into());
} else {
out.push((start_hour, duration));
start_hour = &hour;
start_hour = hour;
duration = Duration::minutes(hour.granularity.into());
}
}

View File

@ -18,10 +18,7 @@ impl str::FromStr for HumanNaiveDate {
type Err = chrono::format::ParseError;
fn from_str(s: &str) -> chrono::format::ParseResult<Self> {
if let Some(days_to_add) = DAY_TERMS
.iter()
.position(|term| s.to_lowercase() == term.to_string())
{
if let Some(days_to_add) = DAY_TERMS.iter().position(|term| s.to_lowercase() == *term) {
let now = chrono::Local::now().naive_local().date();
// days_to_add will never be greater than 2
@ -44,14 +41,14 @@ impl str::FromStr for HumanNaiveDate {
now + chrono::Duration::days(days_to_add.into()),
))
} else {
chrono::NaiveDate::from_str(s).map(|d| HumanNaiveDate(d))
chrono::NaiveDate::from_str(s).map(HumanNaiveDate)
}
}
}
impl Into<chrono::NaiveDate> for HumanNaiveDate {
fn into(self) -> chrono::NaiveDate {
self.0
impl From<HumanNaiveDate> for chrono::NaiveDate {
fn from(val: HumanNaiveDate) -> chrono::NaiveDate {
val.0
}
}