Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/uu/ls/src/colors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// file that was distributed with this source code.
use super::PathData;
use lscolors::{Indicator, LsColors, Style};
use rustc_hash::FxHashMap as HashMap;
use std::borrow::Cow;
use std::collections::HashMap;
use std::env;
use std::ffi::OsString;
use std::fs::{self, Metadata};
Expand Down Expand Up @@ -747,7 +747,7 @@ fn is_valid_ls_colors_prefix(label: [u8; 2]) -> bool {
}

fn parse_indicator_codes() -> (HashMap<Indicator, String>, bool) {
let mut indicator_codes = HashMap::new();
let mut indicator_codes = HashMap::default();
let mut ln_color_from_target = false;

// LS_COLORS validity is checked before enabling color output, so parse
Expand Down Expand Up @@ -827,21 +827,21 @@ mod tests {
#[test]
fn has_indicator_style_ignores_fallback_styles() {
let colors = LsColors::from_string("ex=00:fi=32");
let manager = style_manager(&colors, HashMap::new());
let manager = style_manager(&colors, HashMap::default());
assert!(!manager.has_indicator_style(Indicator::ExecutableFile));
}

#[test]
fn has_indicator_style_detects_explicit_styles() {
let colors = LsColors::from_string("ex=01;32");
let manager = style_manager(&colors, HashMap::new());
let manager = style_manager(&colors, HashMap::default());
assert!(manager.has_indicator_style(Indicator::ExecutableFile));
}

#[test]
fn has_indicator_style_detects_raw_codes() {
let colors = LsColors::empty();
let mut indicator_codes = HashMap::new();
let mut indicator_codes = HashMap::default();
indicator_codes.insert(Indicator::Directory, "01;34".to_string());
let manager = style_manager(&colors, indicator_codes);
assert!(manager.has_indicator_style(Indicator::Directory));
Expand Down
16 changes: 8 additions & 8 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// spell-checker:ignore nohash strtime clocale

#[cfg(unix)]
use rustc_hash::FxHashMap;
use rustc_hash::FxHashSet;
use rustc_hash::FxHashMap as HashMap;
use rustc_hash::FxHashSet as HashSet;
use std::borrow::Cow;
use std::cell::RefCell;
#[cfg(unix)]
Expand Down Expand Up @@ -2195,9 +2195,9 @@ struct ListState<'a> {
// performance was equivalent to BTreeMap.
// It's possible a simple vector linear(binary?) search implementation would be even faster.
#[cfg(unix)]
uid_cache: FxHashMap<u32, String>,
uid_cache: HashMap<u32, String>,
#[cfg(unix)]
gid_cache: FxHashMap<u32, String>,
gid_cache: HashMap<u32, String>,
recent_time_range: RangeInclusive<SystemTime>,
}

Expand All @@ -2212,9 +2212,9 @@ pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()> {
out: BufWriter::new(stdout()),
style_manager: config.color.as_ref().map(StyleManager::new),
#[cfg(unix)]
uid_cache: FxHashMap::default(),
uid_cache: HashMap::default(),
#[cfg(unix)]
gid_cache: FxHashMap::default(),
gid_cache: HashMap::default(),
// Time range for which to use the "recent" format. Anything from 0.5 year in the past to now
// (files with modification time in the future use "old" format).
// According to GNU a Gregorian year has 365.2425 * 24 * 60 * 60 == 31556952 seconds on the average.
Expand Down Expand Up @@ -2303,7 +2303,7 @@ pub fn list(locs: Vec<&Path>, config: &Config) -> UResult<()> {
writeln!(state.out)?;
}
}
let mut listed_ancestors = FxHashSet::default();
let mut listed_ancestors = HashSet::default();
listed_ancestors.insert(FileInformation::from_path(
path_data.path(),
path_data.must_dereference,
Expand Down Expand Up @@ -2441,7 +2441,7 @@ fn enter_directory(
mut read_dir: ReadDir,
config: &Config,
state: &mut ListState,
listed_ancestors: &mut FxHashSet<FileInformation>,
listed_ancestors: &mut HashSet<FileInformation>,
dired: &mut DiredOutput,
) -> UResult<()> {
// Create vec of entries with initial dot files
Expand Down
Loading