summaryrefslogtreecommitdiff
path: root/lib/containers/rbtree.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-01-01 19:27:49 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-01-01 22:42:08 -0700
commitc307e7048da3c02e1e540eab227def7fec7340cc (patch)
treea134fe5f8822e0d9faa7684b6887bc2c139ecd17 /lib/containers/rbtree.go
parent046162cc1ff55985e3dd45eb191729ead1f9cc8d (diff)
lint: Turn on gocritic
Diffstat (limited to 'lib/containers/rbtree.go')
-rw-r--r--lib/containers/rbtree.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/containers/rbtree.go b/lib/containers/rbtree.go
index 17bb3e3..f922a7b 100644
--- a/lib/containers/rbtree.go
+++ b/lib/containers/rbtree.go
@@ -338,11 +338,12 @@ func (t *RBTree[K, V]) Insert(val V) {
Parent: parent,
Value: val,
}
- if parent == nil {
+ switch {
+ case parent == nil:
t.root = node
- } else if key.Cmp(t.KeyFn(parent.Value)) < 0 {
+ case key.Cmp(t.KeyFn(parent.Value)) < 0:
parent.Left = node
- } else {
+ default:
parent.Right = node
}
t.updateAttr(node)