File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use alloc::string::String;
1212use alloc:: vec:: Vec ;
1313use core:: borrow:: Borrow ;
1414use core:: fmt:: { self , Debug } ;
15- use core:: hash:: Hash ;
15+ use core:: hash:: { Hash , Hasher } ;
1616use core:: iter:: FusedIterator ;
1717#[ cfg( feature = "preserve_order" ) ]
1818use core:: mem;
@@ -373,15 +373,15 @@ impl Eq for Map<String, Value> {}
373373#[ cfg( not( feature = "preserve_order" ) ) ]
374374impl Hash for Map < String , Value > {
375375 #[ inline]
376- fn hash < H : core :: hash :: Hasher > ( & self , state : & mut H ) {
376+ fn hash < H : Hasher > ( & self , state : & mut H ) {
377377 self . map . hash ( state) ;
378378 }
379379}
380+
380381#[ cfg( feature = "preserve_order" ) ]
381382impl Hash for Map < String , Value > {
382- #[ inline]
383- fn hash < H : core:: hash:: Hasher > ( & self , state : & mut H ) {
384- let mut kv = self . map . iter ( ) . collect :: < Vec < _ > > ( ) ;
383+ fn hash < H : Hasher > ( & self , state : & mut H ) {
384+ let mut kv = Vec :: from_iter ( & self . map ) ;
385385 kv. sort_unstable_by ( |a, b| a. 0 . cmp ( b. 0 ) ) ;
386386 kv. hash ( state) ;
387387 }
You can’t perform that action at this time.
0 commit comments