time: clippy fixes

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-06-29 10:02:39 +02:00
parent b1a5daef61
commit 1fca7b715d
3 changed files with 5 additions and 3 deletions

View File

@ -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((

View File

@ -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,

View File

@ -175,6 +175,8 @@ pub fn epoch_to_rfc3339_utc(epoch: i64) -> Result<String, Error> {
/// Convert Unix epoch into RFC3339 local time with TZ
pub fn epoch_to_rfc3339(epoch: i64) -> Result<String, Error> {
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<String, Error> {
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)
}