mirror of
https://github.com/lsd-rs/lsd
synced 2025-01-07 09:28:47 +00:00
Fix clippy lints from rust upgrade
This commit is contained in:
parent
5972f6c99a
commit
082c822684
3 changed files with 7 additions and 7 deletions
|
@ -14,7 +14,7 @@ use clap::ArgMatches;
|
||||||
pub enum DateFlag {
|
pub enum DateFlag {
|
||||||
Date,
|
Date,
|
||||||
Relative,
|
Relative,
|
||||||
ISO,
|
Iso,
|
||||||
Formatted(String),
|
Formatted(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ impl Configurable<Self> for DateFlag {
|
||||||
match value.as_str() {
|
match value.as_str() {
|
||||||
"full-iso" => Some(Self::Formatted("%F %T.%f %z".into())),
|
"full-iso" => Some(Self::Formatted("%F %T.%f %z".into())),
|
||||||
"long-iso" => Some(Self::Formatted("%F %R".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),
|
_ if value.starts_with('+') => Self::from_format_string(&value),
|
||||||
_ => {
|
_ => {
|
||||||
print_error!("Not a valid date value: {}.", value);
|
print_error!("Not a valid date value: {}.", value);
|
||||||
|
@ -251,7 +251,7 @@ mod test {
|
||||||
#[serial_test::serial]
|
#[serial_test::serial]
|
||||||
fn test_from_environment_iso() {
|
fn test_from_environment_iso() {
|
||||||
std::env::set_var("TIME_STYLE", "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]
|
#[test]
|
||||||
|
|
|
@ -56,7 +56,7 @@ impl Date {
|
||||||
match &flags.date {
|
match &flags.date {
|
||||||
DateFlag::Date => val.format("%c").to_string(),
|
DateFlag::Date => val.format("%c").to_string(),
|
||||||
DateFlag::Relative => format!("{}", HumanTime::from(*val - Local::now())),
|
DateFlag::Relative => format!("{}", HumanTime::from(*val - Local::now())),
|
||||||
DateFlag::ISO => {
|
DateFlag::Iso => {
|
||||||
// 365.2425 * 24 * 60 * 60 = 31556952 seconds per year
|
// 365.2425 * 24 * 60 * 60 = 31556952 seconds per year
|
||||||
// 15778476 seconds are 6 months
|
// 15778476 seconds are 6 months
|
||||||
if *val > Local::now() - Duration::seconds(15_778_476) {
|
if *val > Local::now() - Duration::seconds(15_778_476) {
|
||||||
|
@ -267,7 +267,7 @@ mod test {
|
||||||
let date = Date::from(&file_path.metadata().unwrap());
|
let date = Date::from(&file_path.metadata().unwrap());
|
||||||
|
|
||||||
let mut flags = Flags::default();
|
let mut flags = Flags::default();
|
||||||
flags.date = DateFlag::ISO;
|
flags.date = DateFlag::Iso;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
creation_date
|
creation_date
|
||||||
|
@ -295,7 +295,7 @@ mod test {
|
||||||
let date = Date::from(&file_path.metadata().unwrap());
|
let date = Date::from(&file_path.metadata().unwrap());
|
||||||
|
|
||||||
let mut flags = Flags::default();
|
let mut flags = Flags::default();
|
||||||
flags.date = DateFlag::ISO;
|
flags.date = DateFlag::Iso;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
creation_date
|
creation_date
|
||||||
|
|
|
@ -225,7 +225,7 @@ impl Meta {
|
||||||
let permissions = Permissions::from(&metadata);
|
let permissions = Permissions::from(&metadata);
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[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 file_type = FileType::new(&metadata, symlink_meta.as_ref(), &permissions);
|
||||||
let name = Name::new(path, file_type);
|
let name = Name::new(path, file_type);
|
||||||
|
|
Loading…
Reference in a new issue