Skip to content

Commit 844bb30

Browse files
committed
Simplify for loop
1 parent 366c0b5 commit 844bb30

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

trie/ctrie/ctrie.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,9 @@ func toContracted(cn *cNode, lev uint) *mainNode {
494494
// toCompressed compacts the C-node as a performance optimization.
495495
func toCompressed(cn *cNode, lev uint) *mainNode {
496496
bmp := cn.bmp
497-
i := 0
498497
arr := cn.array
499498
tmpArray := make([]branch, len(arr))
500-
for i < len(arr) {
501-
sub := arr[i]
499+
for i, sub := range arr {
502500
switch sub.(type) {
503501
case *iNode:
504502
inode := sub.(*iNode)
@@ -510,7 +508,6 @@ func toCompressed(cn *cNode, lev uint) *mainNode {
510508
default:
511509
panic("Ctrie is in an invalid state")
512510
}
513-
i++
514511
}
515512

516513
return toContracted(&cNode{bmp: bmp, array: tmpArray}, lev)

0 commit comments

Comments
 (0)