Skip to content

Commit

Permalink
remove redundant checks
Browse files Browse the repository at this point in the history
  • Loading branch information
azizkayumov committed Nov 11, 2023
1 parent 1d4b3f8 commit f12ce24
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/splay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ impl<P: Path> Forest<P> {
// / \ / \
// 3 4 1 3
fn rotate_left(&mut self, node_idx: usize) {
assert!(
node_idx < self.nodes.len(),
"rotate_left: node_idx out of bounds"
);
assert!(
self.nodes[node_idx].right.is_some(),
"rotate_left: node_idx does not have a right child"
Expand Down Expand Up @@ -188,10 +184,6 @@ impl<P: Path> Forest<P> {
// / \ / \
// 2 3 3 4
fn rotate_right(&mut self, node_idx: usize) {
assert!(
node_idx < self.nodes.len(),
"rotate_right: node_idx out of bounds"
);
assert!(
self.nodes[node_idx].left.is_some(),
"rotate_right: node_idx does not have a left child"
Expand All @@ -218,10 +210,6 @@ impl<P: Path> Forest<P> {

// Rotates the parent of `node_idx` to the right or left, depending on the relationship between.
fn rotate(&mut self, node_idx: usize) {
assert!(
node_idx < self.nodes.len(),
"rotate: node_idx out of bounds"
);
assert!(
matches!(self.nodes[node_idx].parent, Parent::Node(_)),
"rotate: node_idx does not have a parent"
Expand Down

0 comments on commit f12ce24

Please sign in to comment.