158158//! - Compact representation of potentially infinite linked list structure
159159//! ```
160160use std:: {
161- collections:: { BTreeMap , HashMap , HashSet } ,
161+ collections:: { BTreeMap , BTreeSet } ,
162162 fmt:: Display ,
163163} ;
164164
@@ -185,7 +185,7 @@ pub struct TypeGraph {
185185/// Type definition node. Mirrors FieldType but uses [`TypeId`] references.
186186///
187187/// Implements Ord for BTreeMap caching (interning).
188- #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
188+ #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
189189pub enum TypeDef {
190190 Unknown ,
191191 Null ,
@@ -200,7 +200,7 @@ pub enum TypeDef {
200200}
201201
202202/// Named field in object type.
203- #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
203+ #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
204204pub struct ObjectField {
205205 pub name : String ,
206206 pub type_id : TypeId ,
@@ -254,7 +254,7 @@ fn canonicalize(type_def: &mut TypeDef, nodes: &BTreeMap<TypeId, TypeDef>) {
254254#[ derive( Default ) ]
255255struct GraphBuilder {
256256 nodes : BTreeMap < TypeId , TypeDef > ,
257- cache : HashMap < TypeDef , TypeId > ,
257+ cache : BTreeMap < TypeDef , TypeId > ,
258258 iota : Iota ,
259259}
260260
@@ -345,7 +345,7 @@ impl GraphBuilder {
345345#[ derive( Default ) ]
346346struct TypeReducer {
347347 reduced_nodes : BTreeMap < TypeId , TypeDef > ,
348- cache : HashMap < TypeDef , TypeId > ,
348+ cache : BTreeMap < TypeDef , TypeId > ,
349349 remaps : Vec < ( TypeId , TypeId ) > , // original TypeGraph to reduced TypeGraph
350350 iota : Iota ,
351351}
@@ -576,7 +576,7 @@ impl<'type_graph> CanonicalView<'type_graph> {
576576 & self ,
577577 f : & mut std:: fmt:: Formatter < ' _ > ,
578578 type_id : TypeId ,
579- visited : & mut HashSet < TypeId > ,
579+ visited : & mut BTreeSet < TypeId > ,
580580 ) -> std:: fmt:: Result {
581581 if visited. contains ( & type_id) {
582582 return match self . name_registry . assigned_name ( type_id) {
@@ -642,7 +642,7 @@ impl Display for CanonicalView<'_> {
642642 } ?;
643643
644644 // Then print the body of the root type
645- let mut visited = HashSet :: new ( ) ;
645+ let mut visited = BTreeSet :: new ( ) ;
646646 self . fmt_type ( f, self . type_graph . root , & mut visited)
647647 }
648648}
0 commit comments