1- use std :: collections :: HashMap ;
1+ use rustc_hash :: FxHashMap ;
22
33pub enum TagType {
44 Opener ,
@@ -23,11 +23,11 @@ impl TagType {
2323}
2424
2525#[ derive( Clone , Debug , Default ) ]
26- pub struct TagSpecs ( HashMap < String , TagSpec > ) ;
26+ pub struct TagSpecs ( FxHashMap < String , TagSpec > ) ;
2727
2828impl TagSpecs {
2929 #[ must_use]
30- pub fn new ( specs : HashMap < String , TagSpec > ) -> Self {
30+ pub fn new ( specs : FxHashMap < String , TagSpec > ) -> Self {
3131 TagSpecs ( specs)
3232 }
3333
@@ -122,7 +122,7 @@ impl From<&djls_conf::Settings> for TagSpecs {
122122 let mut specs = crate :: builtins:: django_builtin_specs ( ) ;
123123
124124 // Convert and merge user-defined tagspecs
125- let mut user_specs = HashMap :: new ( ) ;
125+ let mut user_specs = FxHashMap :: default ( ) ;
126126 for tagspec_def in settings. tagspecs ( ) {
127127 // Clone because we're consuming the tagspec_def in the conversion
128128 let tagspec: TagSpec = tagspec_def. clone ( ) . into ( ) ;
@@ -312,7 +312,7 @@ mod tests {
312312
313313 // Helper function to create a small test TagSpecs
314314 fn create_test_specs ( ) -> TagSpecs {
315- let mut specs = HashMap :: new ( ) ;
315+ let mut specs = FxHashMap :: default ( ) ;
316316
317317 // Add a simple single tag
318318 specs. insert (
@@ -567,7 +567,7 @@ mod tests {
567567 let mut specs1 = create_test_specs ( ) ;
568568
569569 // Create another TagSpecs with some overlapping and some new tags
570- let mut specs2_map = HashMap :: new ( ) ;
570+ let mut specs2_map = FxHashMap :: default ( ) ;
571571
572572 // Add a new tag
573573 specs2_map. insert (
@@ -626,7 +626,7 @@ mod tests {
626626 let original_count = specs. iter ( ) . count ( ) ;
627627
628628 // Merge with empty TagSpecs
629- specs. merge ( TagSpecs :: new ( HashMap :: new ( ) ) ) ;
629+ specs. merge ( TagSpecs :: new ( FxHashMap :: default ( ) ) ) ;
630630
631631 // Should remain unchanged
632632 assert_eq ! ( specs. iter( ) . count( ) , original_count) ;
0 commit comments