Fix clippy lints from rust upgrade

This commit is contained in:
Abin Simon 2022-02-13 23:10:42 +05:30 committed by Abin Simon
parent 5972f6c99a
commit 082c822684
3 changed files with 7 additions and 7 deletions

View file

@ -14,7 +14,7 @@ use clap::ArgMatches;
pub enum DateFlag {
Date,
Relative,
ISO,
Iso,
Formatted(String),
}
@ -91,7 +91,7 @@ impl Configurable<Self> for DateFlag {
match value.as_str() {
"full-iso" => Some(Self::Formatted("%F %T.%f %z".into())),
"long-iso" => Some(Self::Formatted("%F %R".into())),
"iso" => Some(Self::ISO),
"iso" => Some(Self::Iso),
_ if value.starts_with('+') => Self::from_format_string(&value),
_ => {
print_error!("Not a valid date value: {}.", value);
@ -251,7 +251,7 @@ mod test {
#[serial_test::serial]
fn test_from_environment_iso() {
std::env::set_var("TIME_STYLE", "iso");
assert_eq!(Some(DateFlag::ISO), DateFlag::from_environment());
assert_eq!(Some(DateFlag::Iso), DateFlag::from_environment());
}
#[test]

View file

@ -56,7 +56,7 @@ impl Date {
match &flags.date {
DateFlag::Date => val.format("%c").to_string(),
DateFlag::Relative => format!("{}", HumanTime::from(*val - Local::now())),
DateFlag::ISO => {
DateFlag::Iso => {
// 365.2425 * 24 * 60 * 60 = 31556952 seconds per year
// 15778476 seconds are 6 months
if *val > Local::now() - Duration::seconds(15_778_476) {
@ -267,7 +267,7 @@ mod test {
let date = Date::from(&file_path.metadata().unwrap());
let mut flags = Flags::default();
flags.date = DateFlag::ISO;
flags.date = DateFlag::Iso;
assert_eq!(
creation_date
@ -295,7 +295,7 @@ mod test {
let date = Date::from(&file_path.metadata().unwrap());
let mut flags = Flags::default();
flags.date = DateFlag::ISO;
flags.date = DateFlag::Iso;
assert_eq!(
creation_date

View file

@ -225,7 +225,7 @@ impl Meta {
let permissions = Permissions::from(&metadata);
#[cfg(windows)]
let (owner, permissions) = windows_utils::get_file_data(&path)?;
let (owner, permissions) = windows_utils::get_file_data(path)?;
let file_type = FileType::new(&metadata, symlink_meta.as_ref(), &permissions);
let name = Name::new(path, file_type);