From 9e92bd2a62ae1267aa604d73809d023bf5957c39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Thu, 23 Mar 2023 17:45:55 +0900 Subject: [PATCH] Change hasher --- crates/swc_fast_graph/src/digraph.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/swc_fast_graph/src/digraph.rs b/crates/swc_fast_graph/src/digraph.rs index f6522acce046..e083af67ef19 100644 --- a/crates/swc_fast_graph/src/digraph.rs +++ b/crates/swc_fast_graph/src/digraph.rs @@ -6,7 +6,7 @@ use std::{ cmp::Ordering, fmt, - hash::{self, Hash}, + hash::{self, BuildHasherDefault, Hash}, iter::{Cloned, DoubleEndedIterator, FromIterator}, marker::PhantomData, ops::Deref, @@ -27,6 +27,8 @@ use petgraph::{ }; use swc_common::collections::AHashSet; +type FxBuildHasher = BuildHasherDefault; + /// A `GraphMap` with directed edges. /// /// For example, an edge from *1* to *2* is distinct from an edge from *2* to @@ -59,8 +61,8 @@ pub type FastDiGraphMap = FastGraphMap; /// Depends on crate feature `graphmap` (default). #[derive(Clone)] pub struct FastGraphMap { - nodes: IndexMap, ahash::RandomState>, - edges: IndexMap<(N, N), E, ahash::RandomState>, + nodes: IndexMap, FxBuildHasher>, + edges: IndexMap<(N, N), E, FxBuildHasher>, ty: PhantomData, } @@ -584,7 +586,7 @@ where Ty: EdgeType, { from: N, - edges: &'a IndexMap<(N, N), E, ahash::RandomState>, + edges: &'a IndexMap<(N, N), E, FxBuildHasher>, iter: Neighbors<'a, N, Ty>, }