Skip to content

Commit

Permalink
refactor: use slices.contains (#13356)
Browse files Browse the repository at this point in the history
Using standard library methods to simplify code, inspired by
https://github.com/erigontech/erigon/pull/11380/files

Signed-off-by: dashangcun <[email protected]>
  • Loading branch information
dashangcun authored Jan 10, 2025
1 parent 8cf8b1f commit c5fe936
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions erigon-lib/bptree/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package bptree

import (
"fmt"
"slices"
"strings"
"unsafe"
)
Expand All @@ -31,12 +32,7 @@ func (keys Keys) Less(i, j int) bool { return keys[i] < keys[j] }
func (keys Keys) Swap(i, j int) { keys[i], keys[j] = keys[j], keys[i] }

func (keys Keys) Contains(key Felt) bool {
for _, k := range keys {
if k == key {
return true
}
}
return false
return slices.Contains(keys, key)
}

func (keys Keys) String() string {
Expand Down

0 comments on commit c5fe936

Please sign in to comment.