1
Fork 0
mirror of https://github.com/RGBCube/dix synced 2025-07-27 11:47:46 +00:00

chore: remove rustc-hash dependency, not much overhead

This commit is contained in:
RGBCube 2025-05-09 17:56:50 +03:00 committed by bloxx12
parent d85e9ec3b0
commit 021c972a0f
4 changed files with 10 additions and 24 deletions

7
Cargo.lock generated
View file

@ -190,7 +190,6 @@ dependencies = [
"ref-cast", "ref-cast",
"regex", "regex",
"rusqlite", "rusqlite",
"rustc-hash",
"size", "size",
"unicode-width", "unicode-width",
"yansi", "yansi",
@ -460,12 +459,6 @@ dependencies = [
"smallvec", "smallvec",
] ]
[[package]]
name = "rustc-hash"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.219" version = "1.0.219"

View file

@ -16,7 +16,6 @@ log = "0.4.20"
ref-cast = "1.0.24" ref-cast = "1.0.24"
regex = "1.11.1" regex = "1.11.1"
rusqlite = { version = "0.35.0", features = [ "bundled" ] } rusqlite = { version = "0.35.0", features = [ "bundled" ] }
rustc-hash = "2.1.1"
size = "0.5.0" size = "0.5.0"
unicode-width = "0.2.0" unicode-width = "0.2.0"
yansi = { version = "1.0.1", features = [ "detect-env", "detect-tty" ] } yansi = { version = "1.0.1", features = [ "detect-env", "detect-tty" ] }

View file

@ -1,6 +1,9 @@
use std::fmt::{ use std::{
self, collections::HashMap,
Write as _, fmt::{
self,
Write as _,
},
}; };
use itertools::{ use itertools::{
@ -8,10 +11,6 @@ use itertools::{
Itertools, Itertools,
}; };
use ref_cast::RefCast as _; use ref_cast::RefCast as _;
use rustc_hash::{
FxBuildHasher,
FxHashMap,
};
use unicode_width::UnicodeWidthStr as _; use unicode_width::UnicodeWidthStr as _;
use yansi::Paint as _; use yansi::Paint as _;
@ -48,8 +47,7 @@ pub fn write_diffln<'a>(
paths_old: impl Iterator<Item = &'a StorePath>, paths_old: impl Iterator<Item = &'a StorePath>,
paths_new: impl Iterator<Item = &'a StorePath>, paths_new: impl Iterator<Item = &'a StorePath>,
) -> Result<usize, fmt::Error> { ) -> Result<usize, fmt::Error> {
let mut paths = let mut paths = HashMap::<&str, Diff<Vec<Option<&Version>>>>::new();
FxHashMap::<&str, Diff<Vec<Option<&Version>>>>::with_hasher(FxBuildHasher);
for path in paths_old { for path in paths_old {
match path.parse_name_and_version() { match path.parse_name_and_version() {

View file

@ -1,4 +1,5 @@
use std::{ use std::{
collections::HashMap,
path::Path, path::Path,
result, result,
}; };
@ -8,10 +9,6 @@ use anyhow::{
Result, Result,
}; };
use derive_more::Deref; use derive_more::Deref;
use rustc_hash::{
FxBuildHasher,
FxHashMap,
};
use crate::{ use crate::{
DerivationId, DerivationId,
@ -120,7 +117,7 @@ impl Connection {
pub fn query_dependency_graph( pub fn query_dependency_graph(
&mut self, &mut self,
path: &StorePath, path: &StorePath,
) -> Result<FxHashMap<DerivationId, Vec<DerivationId>>> { ) -> Result<HashMap<DerivationId, Vec<DerivationId>>> {
const QUERY: &str = " const QUERY: &str = "
WITH RECURSIVE WITH RECURSIVE
graph(p, c) AS ( graph(p, c) AS (
@ -137,8 +134,7 @@ impl Connection {
path_to_str!(path); path_to_str!(path);
let mut adj = let mut adj = HashMap::<DerivationId, Vec<DerivationId>>::new();
FxHashMap::<DerivationId, Vec<DerivationId>>::with_hasher(FxBuildHasher);
let mut statement = self.prepare_cached(QUERY)?; let mut statement = self.prepare_cached(QUERY)?;