forked from proxmox-mirrors/proxmox
time: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
b1a5daef61
commit
1fca7b715d
@ -427,7 +427,7 @@ fn parse_time_spec(i: &str) -> IResult<&str, TimeSpec> {
|
|||||||
opt(preceded(tag(":"), parse_date_time_comp_list(0, 60))),
|
opt(preceded(tag(":"), parse_date_time_comp_list(0, 60))),
|
||||||
))(i)?;
|
))(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)]);
|
let second = opt_second.unwrap_or_else(|| vec![DateTimeValue::Single(0)]);
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
|
@ -14,7 +14,7 @@ use crate::{parse_weekdays_range, WeekDays};
|
|||||||
use crate::TmEditor;
|
use crate::TmEditor;
|
||||||
|
|
||||||
/// Time of Day (hour with minute)
|
/// Time of Day (hour with minute)
|
||||||
#[derive(Default, PartialEq, Clone, Debug)]
|
#[derive(Clone, Debug, Default, Eq, PartialEq)]
|
||||||
pub struct HmTime {
|
pub struct HmTime {
|
||||||
pub hour: u32,
|
pub hour: u32,
|
||||||
pub minute: u32,
|
pub minute: u32,
|
||||||
|
@ -175,6 +175,8 @@ pub fn epoch_to_rfc3339_utc(epoch: i64) -> Result<String, Error> {
|
|||||||
|
|
||||||
/// Convert Unix epoch into RFC3339 local time with TZ
|
/// Convert Unix epoch into RFC3339 local time with TZ
|
||||||
pub fn epoch_to_rfc3339(epoch: i64) -> Result<String, Error> {
|
pub fn epoch_to_rfc3339(epoch: i64) -> Result<String, Error> {
|
||||||
|
use std::fmt::Write as _;
|
||||||
|
|
||||||
let localtime = localtime(epoch)?;
|
let localtime = localtime(epoch)?;
|
||||||
|
|
||||||
let year = localtime.tm_year + 1900;
|
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)?;
|
let mut s = strftime("%10FT%T", &localtime)?;
|
||||||
s.push(prefix);
|
s.push(prefix);
|
||||||
s.push_str(&format!("{:02}:{:02}", hours, mins));
|
let _ = write!(s, "{:02}:{:02}", hours, mins);
|
||||||
|
|
||||||
Ok(s)
|
Ok(s)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user