From ae0423835d195f915b582ce7e5b25bca128142d0 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 20 Sep 2023 15:34:26 -0700 Subject: [PATCH] Introduce `FastIndexMap` type alias, and use it for NamedExpressions. --- src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 92a0ba2ce2..b220872dd0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -310,12 +310,13 @@ pub type FastHashSet = rustc_hash::FxHashSet; pub type FastIndexSet = indexmap::IndexSet>; +/// Insertion-order-preserving hash map (`IndexMap`), but with the same +/// hasher as `FastHashMap` (faster but not resilient to DoS attacks). +pub type FastIndexMap = + indexmap::IndexMap>; + /// Map of expressions that have associated variable names -pub(crate) type NamedExpressions = indexmap::IndexMap< - Handle, - String, - std::hash::BuildHasherDefault, ->; +pub(crate) type NamedExpressions = FastIndexMap, String>; /// Early fragment tests. ///