@@ -27,7 +27,7 @@ pub struct DiffContext<'a, S: SerializeSeq> {
2727 /// Mode for serializing field paths
2828 field_path_mode : FieldPathMode ,
2929 /// Set to true if any change is detected
30- has_changes : bool ,
30+ has_changes : & ' a mut bool ,
3131}
3232
3333impl < ' a , S : SerializeSeq > Drop for DiffContext < ' a , S > {
@@ -52,7 +52,7 @@ impl<'a, S: SerializeSeq> DiffContext<'a, S> {
5252
5353 /// True if a change operation has been written
5454 pub fn has_changes ( & self ) -> bool {
55- self . has_changes
55+ * self . has_changes
5656 }
5757
5858 /// Called when we visit a field. If the structure is recursive (i.e. struct within struct,
@@ -186,7 +186,7 @@ impl<'a, S: SerializeSeq> DiffContext<'a, S> {
186186 }
187187 self . element_stack_start = 0 ;
188188 }
189- self . has_changes |= is_change;
189+ * self . has_changes |= is_change;
190190 self . implicit_exit_written = implicit_exit;
191191 self . serializer . serialize_element ( value)
192192 }
@@ -225,7 +225,7 @@ impl<'a, S: SerializeSeq> DiffContext<'a, S> {
225225 serializer : & mut * self . serializer ,
226226 implicit_exit_written : self . implicit_exit_written ,
227227 field_path_mode : self . field_path_mode ,
228- has_changes : false ,
228+ has_changes : self . has_changes ,
229229 }
230230 }
231231}
@@ -294,7 +294,7 @@ impl<'a, 'b, T: SerdeDiff> Serialize for Diff<'a, 'b, T> {
294294 implicit_exit_written : false ,
295295 parent_element_stack : None ,
296296 field_path_mode : self . field_path_mode ,
297- has_changes : false ,
297+ has_changes : & mut false ,
298298 } ;
299299 self . old . diff ( & mut ctx, & self . new ) . unwrap ( ) ;
300300 }
@@ -314,13 +314,13 @@ impl<'a, 'b, T: SerdeDiff> Serialize for Diff<'a, 'b, T> {
314314 implicit_exit_written : false ,
315315 parent_element_stack : None ,
316316 field_path_mode : self . field_path_mode ,
317- has_changes : false ,
317+ has_changes : & mut false ,
318318 } ;
319319
320320 // Do the actual comparison, writing diff commands (see DiffCommandRef, DiffCommandValue)
321321 // into the sequence
322322 self . old . diff ( & mut ctx, & self . new ) ?;
323- self . has_changes . set ( ctx. has_changes ) ;
323+ self . has_changes . set ( * ctx. has_changes ) ;
324324 }
325325
326326 // End the sequence on the serializer
0 commit comments