diff --git a/src/context/sort.rs b/src/context/sort.rs index 60a34a6f..b7d9043f 100644 --- a/src/context/sort.rs +++ b/src/context/sort.rs @@ -16,20 +16,26 @@ pub enum Type { Rsize, /// Sort entries by newer to older Accessing Date + #[value(alias("atime"))] Access, /// Sort entries by older to newer Accessing Date + #[value(alias("ratime"))] Raccess, /// Sort entries by newer to older Creation Date + #[value(alias("ctime"))] Create, /// Sort entries by older to newer Creation Date + #[value(alias("rctime"))] Rcreate, /// Sort entries by newer to older Alteration Date + #[value(alias("mtime"))] Mod, /// Sort entries by older to newer Alteration Date + #[value(alias("rmtime"))] Rmod, } diff --git a/src/main.rs b/src/main.rs index fb203a7d..e66ca5fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,7 +10,7 @@ clippy::style, clippy::suspicious )] -#![allow(clippy::cast_precision_loss, clippy::struct_excessive_bools)] +#![allow(clippy::cast_precision_loss, clippy::struct_excessive_bools, clippy::wildcard_imports)] use clap::CommandFactory; use context::{layout, Context}; diff --git a/src/tree/mod.rs b/src/tree/mod.rs index f4c4845c..7e32fa60 100644 --- a/src/tree/mod.rs +++ b/src/tree/mod.rs @@ -221,10 +221,6 @@ impl Tree { let node = tree[index].get(); - #[cfg(unix)] - Self::update_column_properties(column_properties, node, ctx); - - #[cfg(not(unix))] Self::update_column_properties(column_properties, node, ctx); // If a hard-link is already accounted for then don't increment parent dir size. diff --git a/src/tree/node/cmp.rs b/src/tree/node/cmp.rs index cac2bda1..9535b2be 100644 --- a/src/tree/node/cmp.rs +++ b/src/tree/node/cmp.rs @@ -63,16 +63,18 @@ fn base_comparator(sort_type: sort::Type) -> Box { } mod time_stamping { + pub(self) use crate::tree::node::Node; + pub(self) use core::cmp::Ordering; + pub(self) use std::time::SystemTime; + pub mod accessed { - use crate::tree::node::Node; - use core::cmp::Ordering; - use std::time::SystemTime; + use super::*; /// Comparator that sorts [Node]s by Last Access timestamp, newer to older. pub fn comparator(a: &Node, b: &Node) -> Ordering { let a_stamp = a.accessed().unwrap_or_else(SystemTime::now); let b_stamp = b.accessed().unwrap_or_else(SystemTime::now); - a_stamp.cmp(&b_stamp) + b_stamp.cmp(&a_stamp) } /// Comparator that sorts [Node]s by Access timestamp, older to newer. @@ -82,15 +84,13 @@ mod time_stamping { } pub mod created { - use crate::tree::node::Node; - use core::cmp::Ordering; - use std::time::SystemTime; + use super::*; /// Comparator that sorts [Node]s by Creation timestamp, newer to older. pub fn comparator(a: &Node, b: &Node) -> Ordering { let a_stamp = a.created().unwrap_or_else(SystemTime::now); let b_stamp = b.created().unwrap_or_else(SystemTime::now); - a_stamp.cmp(&b_stamp) + b_stamp.cmp(&a_stamp) } /// Comparator that sorts [Node]s by Creation timestamp, older to newer. @@ -100,15 +100,13 @@ mod time_stamping { } pub mod modified { - use crate::tree::node::Node; - use core::cmp::Ordering; - use std::time::SystemTime; + use super::*; /// Comparator that sorts [Node]s by Alteration timestamp, newer to older. pub fn comparator(a: &Node, b: &Node) -> Ordering { let a_stamp = a.modified().unwrap_or_else(SystemTime::now); let b_stamp = b.modified().unwrap_or_else(SystemTime::now); - a_stamp.cmp(&b_stamp) + b_stamp.cmp(&a_stamp) } /// Comparator that sorts [Node]s by Alteration timestamp, older to newer.