chore: apply clippy's suggestions
parent
10140d879c
commit
180768b858
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue