Skip to content

Commit d089e22

Browse files
committed
Fix subtraction bug in merge_sorted_into
1 parent f52c712 commit d089e22

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

regex-syntax/src/hir/interval.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,9 @@ fn merge_sorted_into<T: Default + Ord>(
708708
// First, shift all the items that are ``> new_item`` rightward
709709
// in the vec
710710
for item_idx in (0..dest_len).rev() {
711-
dest_len -= 1;
712-
insert_idx -= 1;
713-
714711
if dest[item_idx] > new_item {
712+
dest_len -= 1;
713+
insert_idx -= 1;
715714
dest.swap(item_idx, insert_idx);
716715
} else {
717716
break;

0 commit comments

Comments
 (0)