diff --git a/Cargo.lock b/Cargo.lock index ba19742..4a4d96c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -476,6 +476,12 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + [[package]] name = "num-integer" version = "0.1.44" @@ -870,6 +876,7 @@ dependencies = [ "dirs-next", "escaper", "lazy_static", + "nohash-hasher", "opml", "pancurses", "regex", diff --git a/Cargo.toml b/Cargo.toml index c55bf62..8f7c5e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ sanitize-filename = "0.2.1" shellexpand = "2.0.0" dirs = { package = "dirs-next", version = "1.0.1" } opml = "0.2.4" +nohash-hasher = "0.2.0" unicode-segmentation = "1.6.0" textwrap = "0.12.1" escaper = "0.1.0" diff --git a/src/types.rs b/src/types.rs index d571a4f..0b28387 100644 --- a/src/types.rs +++ b/src/types.rs @@ -6,6 +6,7 @@ use unicode_segmentation::UnicodeSegmentation; use chrono::{DateTime, Utc}; use lazy_static::lazy_static; +use nohash_hasher::BuildNoHashHasher; use regex::Regex; use crate::downloads::DownloadMsg; @@ -273,14 +274,14 @@ impl Menuable for NewEpisode { pub struct LockVec where T: Clone + Menuable { - data: Arc>>, + data: Arc>>>, order: Arc>>, } impl LockVec { /// Create a new LockVec. pub fn new(data: Vec) -> LockVec { - let mut hm = HashMap::new(); + let mut hm = HashMap::with_hasher(BuildNoHashHasher::default()); let mut order = Vec::new(); for i in data.into_iter() { let id = i.get_id(); @@ -295,7 +296,7 @@ impl LockVec { } /// Lock the LockVec hashmap for reading/writing. - pub fn borrow_map(&self) -> MutexGuard> { + pub fn borrow_map(&self) -> MutexGuard>> { return self.data.lock().unwrap(); } @@ -305,7 +306,13 @@ impl LockVec { } /// Lock the LockVec hashmap for reading/writing. - pub fn borrow(&self) -> (MutexGuard>, MutexGuard>) { + #[allow(clippy::type_complexity)] + pub fn borrow( + &self, + ) -> ( + MutexGuard>>, + MutexGuard>, + ) { return (self.data.lock().unwrap(), self.order.lock().unwrap()); }