@@ -299,15 +299,10 @@ fn compare_ins(
299
299
) -> Result < InsDiffResult > {
300
300
let mut result = InsDiffResult :: default ( ) ;
301
301
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 {
311
306
// Totally different op
312
307
result. kind = ObjInsDiffKind :: Replace ;
313
308
state. diff_count += 1 ;
@@ -318,7 +313,7 @@ fn compare_ins(
318
313
result. kind = ObjInsDiffKind :: OpMismatch ;
319
314
state. diff_count += 1 ;
320
315
}
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 ( ) ) {
322
317
if arg_eq ( config, left_obj, right_obj, a, b, left, right) {
323
318
result. left_args_diff . push ( None ) ;
324
319
result. right_args_diff . push ( None ) ;
0 commit comments