From a702b6ec428ce8c899c2b2cdea979012ee435c9c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 12 Jan 2022 12:28:03 +0100 Subject: [PATCH] AK: Remove unnecessary null checks in RedBlackTree --- AK/RedBlackTree.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/AK/RedBlackTree.h b/AK/RedBlackTree.h index 713888f7f4..e88813402e 100644 --- a/AK/RedBlackTree.h +++ b/AK/RedBlackTree.h @@ -521,10 +521,8 @@ public: void clear() { - if (this->m_root) { - delete this->m_root; - this->m_root = nullptr; - } + delete this->m_root; + this->m_root = nullptr; this->m_minimum = nullptr; this->m_size = 0; } @@ -542,10 +540,8 @@ private: ~Node() { - if (this->left_child) - delete this->left_child; - if (this->right_child) - delete this->right_child; + delete this->left_child; + delete this->right_child; } }; };