From dcc730e889c70fde0ff596ac0ea1e35e03aeb43e Mon Sep 17 00:00:00 2001 From: Karl Gaissmaier Date: Fri, 27 Jan 2023 22:29:45 +0100 Subject: [PATCH] minor --- treap.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/treap.go b/treap.go index adfe498..27d38f4 100644 --- a/treap.go +++ b/treap.go @@ -241,8 +241,7 @@ func (n *node[T]) split(key T, immutable bool, t *Tree[T]) (left, mid, right *no n = n.copyNode() } - cmp := t.compare(n.item, key) - switch { + switch cmp := t.compare(n.item, key); { case cmp < 0: l, m, r := n.right.split(key, immutable, t) n.right = l @@ -288,8 +287,7 @@ func (t Tree[T]) Find(item T) (result T, ok bool) { return } - cmp := t.compare(item, n.item) - switch { + switch cmp := t.compare(item, n.item); { case cmp == 0: return n.item, true case cmp < 0: @@ -375,8 +373,7 @@ func (n *node[T]) lcp(item T, t *Tree[T]) (result T, ok bool) { return } - cmp := t.compare(n.item, item) - switch { + switch cmp := t.compare(n.item, item); { case cmp > 0: // left rec-descent return n.left.lcp(item, t)