@@ -378,6 +378,11 @@ impl CodeSuggestion {
378378            } ) 
379379            . cloned ( ) 
380380            . filter_map ( |mut  substitution| { 
381+                 // Account for cases where we are suggesting the same code that's already 
382+                 // there. This shouldn't happen often, but in some cases for multipart 
383+                 // suggestions it's much easier to handle it here than in the origin. 
384+                 substitution. parts . retain ( |p| is_different ( sm,  & p. snippet ,  p. span ) ) ; 
385+ 
381386                // Assumption: all spans are in the same file, and all spans 
382387                // are disjoint. Sort in ascending order. 
383388                substitution. parts . sort_by_key ( |part| part. span . lo ( ) ) ; 
@@ -470,16 +475,12 @@ impl CodeSuggestion {
470475                            _ => 1 , 
471476                        } ) 
472477                        . sum ( ) ; 
473-                     if  !is_different ( sm,  & part. snippet ,  part. span )  { 
474-                         // Account for cases where we are suggesting the same code that's already 
475-                         // there. This shouldn't happen often, but in some cases for multipart 
476-                         // suggestions it's much easier to handle it here than in the origin. 
477-                     }  else  { 
478-                         line_highlight. push ( SubstitutionHighlight  { 
479-                             start :  ( cur_lo. col . 0  as  isize  + acc)  as  usize , 
480-                             end :  ( cur_lo. col . 0  as  isize  + acc + len)  as  usize , 
481-                         } ) ; 
482-                     } 
478+ 
479+                     line_highlight. push ( SubstitutionHighlight  { 
480+                         start :  ( cur_lo. col . 0  as  isize  + acc)  as  usize , 
481+                         end :  ( cur_lo. col . 0  as  isize  + acc + len)  as  usize , 
482+                     } ) ; 
483+ 
483484                    buf. push_str ( & part. snippet ) ; 
484485                    let  cur_hi = sm. lookup_char_pos ( part. span . hi ( ) ) ; 
485486                    // Account for the difference between the width of the current code and the 
0 commit comments