summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2024-07-04 19:12:32 +0200
committerCanop <cano.petrole@gmail.com>2024-07-04 19:12:32 +0200
commit37dc621ee9eb8021b7ffd12dc49f0b5784f2a369 (patch)
tree488a0f17e5cf860d1ea6c71ce774def71595c1ba
parentfc05ea77cfeb31f862bd1aecd28ec1ebb322a9a8 (diff)
remove fnv dependency
-rw-r--r--Cargo.lock1
-rw-r--r--Cargo.toml1
-rw-r--r--src/conf/conf.rs3
-rw-r--r--src/file_sum/sum_computation.rs8
-rw-r--r--src/pattern/search_mode.rs6
-rw-r--r--src/permissions/permissions_unix.rs10
-rw-r--r--src/tree/tree.rs8
7 files changed, 18 insertions, 19 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 262fdf7..e46cad7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -221,7 +221,6 @@ dependencies = [
"deser-hjson",
"directories 4.0.1",
"file-size",
- "fnv",
"git2",
"glassbench",
"glob",
diff --git a/Cargo.toml b/Cargo.toml
index 04c0d56..97229ce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -37,7 +37,6 @@ custom_error = "1.6"
deser-hjson = "2.2.3"
directories = "4.0"
file-size = "1.0.3"
-fnv = "1.0.7"
git2 = { version = "0.14", default-features = false }
glob = "0.3"
id-arena = "2.2.1"
diff --git a/src/conf/conf.rs b/src/conf/conf.rs
index 98df97e..77a4d26 100644
--- a/src/conf/conf.rs
+++ b/src/conf/conf.rs
@@ -18,7 +18,6 @@ use {
},
rustc_hash::FxHashMap,
crokey::crossterm::style::Attribute,
- fnv::FnvHashMap,
serde::Deserialize,
std::collections::HashMap,
std::path::PathBuf,
@@ -104,7 +103,7 @@ pub struct Conf {
pub quit_on_last_cancel: Option<bool>,
#[serde(alias="search-modes")]
- pub search_modes: Option<FnvHashMap<String, String>>,
+ pub search_modes: Option<FxHashMap<String, String>>,
#[serde(alias="show-matching-characters-on-path-searches")]
pub show_matching_characters_on_path_searches: Option<bool>,
diff --git a/src/file_sum/sum_computation.rs b/src/file_sum/sum_computation.rs
index 7f35ade..7821ec3 100644
--- a/src/file_sum/sum_computation.rs
+++ b/src/file_sum/sum_computation.rs
@@ -10,7 +10,10 @@ use {
ThreadPool,
ThreadPoolBuilder,
},
- rustc_hash::FxHashMap,
+ rustc_hash::{
+ FxHashMap,
+ FxHashSet,
+ },
std::{
convert::TryInto,
fs,
@@ -31,7 +34,6 @@ use {
#[cfg(unix)]
use {
- fnv::FnvHashSet,
std::os::unix::fs::MetadataExt,
};
@@ -91,7 +93,7 @@ impl DirSummer {
// to avoid counting twice a node, we store their id in a set
#[cfg(unix)]
- let nodes = Arc::new(Mutex::new(FnvHashSet::<NodeId>::default()));
+ let nodes = Arc::new(Mutex::new(FxHashSet::<NodeId>::default()));
// busy is the number of directories which are either being processed or queued
// We use this count to determine when threads can stop waiting for tasks
diff --git a/src/pattern/search_mode.rs b/src/pattern/search_mode.rs
index 2d727b9..8854949 100644
--- a/src/pattern/search_mode.rs
+++ b/src/pattern/search_mode.rs
@@ -4,7 +4,7 @@ use {
app::AppContext,
errors::{ConfError, PatternError},
},
- fnv::FnvHashMap,
+ rustc_hash::FxHashMap,
lazy_regex::regex_is_match,
std::convert::TryFrom,
};
@@ -214,9 +214,9 @@ impl Default for SearchModeMap {
}
}
-impl TryFrom<&FnvHashMap<String, String>> for SearchModeMap {
+impl TryFrom<&FxHashMap<String, String>> for SearchModeMap {
type Error = ConfError;
- fn try_from(map: &FnvHashMap<String, String>) -> Result<Self, Self::Error> {
+ fn try_from(map: &FxHashMap<String, String>) -> Result<Self, Self::Error> {
let mut smm = Self::default();
for (k, v) in map {
smm.entries.push(SearchModeMapEntry::parse(k, v)?);
diff --git a/src/permissions/permissions_unix.rs b/src/permissions/permissions_unix.rs
index 8ed43b4..72d58f3 100644
--- a/src/permissions/permissions_unix.rs
+++ b/src/permissions/permissions_unix.rs
@@ -1,5 +1,5 @@
use {
- fnv::FnvHashMap,
+ rustc_hash::FxHashMap,
once_cell::sync::Lazy,
std::sync::Mutex,
};
@@ -9,8 +9,8 @@ pub fn supported() -> bool {
}
pub fn user_name(uid: u32) -> String {
- static USERS_CACHE_MUTEX: Lazy<Mutex<FnvHashMap<u32, String>>> = Lazy::new(|| {
- Mutex::new(FnvHashMap::default())
+ static USERS_CACHE_MUTEX: Lazy<Mutex<FxHashMap<u32, String>>> = Lazy::new(|| {
+ Mutex::new(FxHashMap::default())
});
let mut users_cache = USERS_CACHE_MUTEX.lock().unwrap();
let name = users_cache
@@ -25,8 +25,8 @@ pub fn user_name(uid: u32) -> String {
}
pub fn group_name(gid: u32) -> String {
- static GROUPS_CACHE_MUTEX: Lazy<Mutex<FnvHashMap<u32, String>>> = Lazy::new(|| {
- Mutex::new(FnvHashMap::default())
+ static GROUPS_CACHE_MUTEX: Lazy<Mutex<FxHashMap<u32, String>>> = Lazy::new(|| {
+ Mutex::new(FxHashMap::default())
});
let mut groups_cache = GROUPS_CACHE_MUTEX.lock().unwrap();
let name = groups_cache
diff --git a/src/tree/tree.rs b/src/tree/tree.rs
index c57e3db..94a11f9 100644
--- a/src/tree/tree.rs
+++ b/src/tree/tree.rs
@@ -9,7 +9,7 @@ use {
task_sync::Dam,
tree_build::{BId, BuildReport, TreeBuilder},
},
- fnv::FnvHashMap,
+ rustc_hash::FxHashMap,
std::{
cmp::Ord,
mem,
@@ -73,15 +73,15 @@ impl Tree {
// - we want a case insensitive sort
// - we still don't want to confuse the children of AA and Aa
// - a node can come from a not parent node, when we followed a link
- let mut bid_parents: FnvHashMap<BId, BId> = FnvHashMap::default();
- let mut bid_lines: FnvHashMap<BId, &TreeLine> = FnvHashMap::default();
+ let mut bid_parents: FxHashMap<BId, BId> = FxHashMap::default();
+ let mut bid_lines: FxHashMap<BId, &TreeLine> = FxHashMap::default();
for line in self.lines[..].iter() {
if let Some(parent_bid) = line.parent_bid {
bid_parents.insert(line.bid, parent_bid);
}
bid_lines.insert(line.bid, line);
}
- let mut sort_paths: FnvHashMap<BId, String> = FnvHashMap::default();
+ let mut sort_paths: FxHashMap<BId, String> = FxHashMap::default();
for line in self.lines[1..].iter() {
let mut sort_path = String::new();
let mut bid = line.bid;