@@ -155,9 +155,11 @@ fn unify_two_structures(
155155
156156 // Objects: must have same fields, unify field-wise
157157 ( JSONStructure :: Object ( fields1) , JSONStructure :: Object ( fields2) ) => {
158- // Convert to HashMaps for easier lookup
159- let map1: HashMap < _ , _ > = fields1. iter ( ) . map ( |( k, v) | ( k, v) ) . collect ( ) ;
160- let map2: HashMap < _ , _ > = fields2. iter ( ) . map ( |( k, v) | ( k, v) ) . collect ( ) ;
158+ // Convert to HashMaps for easier lookup (using owned String keys)
159+ let map1: HashMap < String , & JSONStructure > =
160+ fields1. iter ( ) . map ( |( k, v) | ( k. clone ( ) , v) ) . collect ( ) ;
161+ let map2: HashMap < String , & JSONStructure > =
162+ fields2. iter ( ) . map ( |( k, v) | ( k. clone ( ) , v) ) . collect ( ) ;
161163
162164 // Check that both objects have the same set of keys
163165 if map1. len ( ) != map2. len ( ) {
@@ -169,7 +171,7 @@ fn unify_two_structures(
169171 match map2. get ( key) {
170172 Some ( val2) => {
171173 let unified_val = unify_two_structures ( val1, val2) ?;
172- unified_fields. push ( ( ( * key) . clone ( ) , unified_val) ) ;
174+ unified_fields. push ( ( key. clone ( ) , unified_val) ) ;
173175 }
174176 None => return Err ( UnifyError :: ObjectFieldMismatch ) ,
175177 }
0 commit comments