From f12ce2450cfe5094f66080f4caab71fcd5f2b2ef Mon Sep 17 00:00:00 2001 From: azizkayumov Date: Sun, 12 Nov 2023 03:51:08 +0900 Subject: [PATCH] remove redundant checks --- src/splay.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/splay.rs b/src/splay.rs index 216c229..ef32afd 100644 --- a/src/splay.rs +++ b/src/splay.rs @@ -152,10 +152,6 @@ impl Forest

{ // / \ / \ // 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" @@ -188,10 +184,6 @@ impl Forest

{ // / \ / \ // 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" @@ -218,10 +210,6 @@ impl Forest

{ // 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"