diff --git a/proxmox-time/src/calendar_event.rs b/proxmox-time/src/calendar_event.rs index c70d9eae..59f61a7f 100644 --- a/proxmox-time/src/calendar_event.rs +++ b/proxmox-time/src/calendar_event.rs @@ -427,7 +427,7 @@ fn parse_time_spec(i: &str) -> IResult<&str, TimeSpec> { opt(preceded(tag(":"), parse_date_time_comp_list(0, 60))), ))(i)?; - let hour = opt_hour.unwrap_or_else(Vec::new); + let hour = opt_hour.unwrap_or_default(); let second = opt_second.unwrap_or_else(|| vec![DateTimeValue::Single(0)]); Ok(( diff --git a/proxmox-time/src/daily_duration.rs b/proxmox-time/src/daily_duration.rs index 37c4f6ab..078cf79c 100644 --- a/proxmox-time/src/daily_duration.rs +++ b/proxmox-time/src/daily_duration.rs @@ -14,7 +14,7 @@ use crate::{parse_weekdays_range, WeekDays}; use crate::TmEditor; /// Time of Day (hour with minute) -#[derive(Default, PartialEq, Clone, Debug)] +#[derive(Clone, Debug, Default, Eq, PartialEq)] pub struct HmTime { pub hour: u32, pub minute: u32, diff --git a/proxmox-time/src/posix.rs b/proxmox-time/src/posix.rs index 6a8ab700..d8a9130d 100644 --- a/proxmox-time/src/posix.rs +++ b/proxmox-time/src/posix.rs @@ -175,6 +175,8 @@ pub fn epoch_to_rfc3339_utc(epoch: i64) -> Result { /// Convert Unix epoch into RFC3339 local time with TZ pub fn epoch_to_rfc3339(epoch: i64) -> Result { + use std::fmt::Write as _; + let localtime = localtime(epoch)?; let year = localtime.tm_year + 1900; @@ -199,7 +201,7 @@ pub fn epoch_to_rfc3339(epoch: i64) -> Result { let mut s = strftime("%10FT%T", &localtime)?; s.push(prefix); - s.push_str(&format!("{:02}:{:02}", hours, mins)); + let _ = write!(s, "{:02}:{:02}", hours, mins); Ok(s) }