@@ -372,22 +372,26 @@ impl HighlightedRangeStack {
372
372
} else {
373
373
let maybe_idx =
374
374
prev. iter ( ) . position ( |parent| parent. range . contains ( child. range . start ( ) ) ) ;
375
- if let ( Some ( _) , Some ( idx) ) = ( overwrite_parent, maybe_idx) {
376
- Self :: intersect_partial ( & mut prev[ idx] , & child) ;
377
- let insert_idx = if prev[ idx] . range . is_empty ( ) {
378
- prev. remove ( idx) ;
379
- idx
380
- } else {
381
- idx + 1
382
- } ;
383
- prev. insert ( insert_idx, child) ;
384
- } else if let None = maybe_idx {
385
- let idx = prev
386
- . binary_search_by_key ( & child. range . start ( ) , |range| range. range . start ( ) )
387
- . unwrap_or_else ( |x| x) ;
388
- prev. insert ( idx, child) ;
389
- } else {
390
- unreachable ! ( "child range should be completely contained in parent range" ) ;
375
+ match ( overwrite_parent, maybe_idx) {
376
+ ( Some ( _) , Some ( idx) ) => {
377
+ Self :: intersect_partial ( & mut prev[ idx] , & child) ;
378
+ let insert_idx = if prev[ idx] . range . is_empty ( ) {
379
+ prev. remove ( idx) ;
380
+ idx
381
+ } else {
382
+ idx + 1
383
+ } ;
384
+ prev. insert ( insert_idx, child) ;
385
+ }
386
+ ( _, None ) => {
387
+ let idx = prev
388
+ . binary_search_by_key ( & child. range . start ( ) , |range| range. range . start ( ) )
389
+ . unwrap_or_else ( |x| x) ;
390
+ prev. insert ( idx, child) ;
391
+ }
392
+ _ => {
393
+ unreachable ! ( "child range should be completely contained in parent range" ) ;
394
+ }
391
395
}
392
396
}
393
397
}
0 commit comments