From 2d7652a3045a3dfb81fe30f958245b300824e45d Mon Sep 17 00:00:00 2001 From: tommi Date: Wed, 22 Jan 2025 16:59:59 +0100 Subject: [PATCH] Style refactoring --- Cargo.lock | 1 - src/uu/date/src/date.rs | 2 +- src/uu/ls/Cargo.toml | 1 - src/uu/ls/src/ls.rs | 8 +++----- src/uucore/Cargo.toml | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c7d61d41d..b02f7eaa90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2877,7 +2877,6 @@ version = "0.0.29" dependencies = [ "ansi-width", "chrono", - "chrono-tz", "clap", "glob", "hostname", diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 4e47c1bf7d..a3f2ad0426 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -273,7 +273,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { for date in dates { match date { Ok(date) => { - let format_string = custom_time_format(&format_string); + let format_string = custom_time_format(format_string); // Refuse to pass this string to chrono as it is crashing in this crate if format_string.contains("%#z") { return Err(USimpleError::new( diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 3c14023f13..a21f178542 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -19,7 +19,6 @@ path = "src/ls.rs" [dependencies] ansi-width = { workspace = true } chrono = { workspace = true } -chrono-tz = { workspace = true } clap = { workspace = true, features = ["env"] } glob = { workspace = true } hostname = { workspace = true } diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1bfb612a9c..9a1fc795f7 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -360,11 +360,9 @@ impl TimeStyle { //So it's not yet implemented (Self::Locale, true) => time.format("%b %e %H:%M").to_string(), (Self::Locale, false) => time.format("%b %e %Y").to_string(), - (Self::Format(fmt), _) => { - // this line can be replaced with the one in timzone_date.rs - time.format(custom_tz_fmt::custom_time_format(fmt).as_str()) - .to_string() - } + (Self::Format(fmt), _) => time + .format(custom_tz_fmt::custom_time_format(fmt).as_str()) + .to_string(), } } } diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 2c7653795c..bc10328fbb 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -19,7 +19,7 @@ path = "src/lib/lib.rs" [dependencies] chrono = { workspace = true } -chrono-tz = {workspace = true} +chrono-tz = { workspace = true } clap = { workspace = true } uucore_procs = { workspace = true } number_prefix = { workspace = true }