@@ -299,15 +299,10 @@ fn compare_ins(
299299) -> Result < InsDiffResult > {
300300 let mut result = InsDiffResult :: default ( ) ;
301301 if let ( Some ( left_ins) , Some ( right_ins) ) = ( & left. ins , & right. ins ) {
302- if left_ins. args . len ( ) != right_ins. args . len ( )
303- || left_ins. op != right_ins. op
304- // Check if any PlainText segments differ (punctuation and spacing)
305- // This indicates a more significant difference than a simple arg mismatch
306- || !left_ins. args . iter ( ) . zip ( & right_ins. args ) . all ( |( a, b) | match ( a, b) {
307- ( ObjInsArg :: PlainText ( l) , ObjInsArg :: PlainText ( r) ) => l == r,
308- _ => true ,
309- } )
310- {
302+ // Count only non-PlainText args
303+ let left_args_count = left_ins. iter_args ( ) . count ( ) ;
304+ let right_args_count = right_ins. iter_args ( ) . count ( ) ;
305+ if left_args_count != right_args_count || left_ins. op != right_ins. op {
311306 // Totally different op
312307 result. kind = ObjInsDiffKind :: Replace ;
313308 state. diff_count += 1 ;
@@ -318,7 +313,7 @@ fn compare_ins(
318313 result. kind = ObjInsDiffKind :: OpMismatch ;
319314 state. diff_count += 1 ;
320315 }
321- for ( a, b) in left_ins. args . iter ( ) . zip ( & right_ins. args ) {
316+ for ( a, b) in left_ins. iter_args ( ) . zip ( right_ins. iter_args ( ) ) {
322317 if arg_eq ( config, left_obj, right_obj, a, b, left, right) {
323318 result. left_args_diff . push ( None ) ;
324319 result. right_args_diff . push ( None ) ;
0 commit comments