Skip to content

Commit

Permalink
simplify priority shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheemdev committed Feb 27, 2024
1 parent f7cd626 commit 0e51fa9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,9 @@ impl<T> Node<T> {
updated -= 1;
}

// build new index list
// update the index position
if updated != i {
self.indices = [
&self.indices[..updated], // unchanged prefix, might be empty
&self.indices[i..=i], // the index char we move
&self.indices[updated..i], // rest without char at 'pos'
&self.indices[i + 1..],
]
.concat();
self.indices[updated..=i].rotate_right(1);
}

updated
Expand Down

0 comments on commit 0e51fa9

Please sign in to comment.