mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-27 05:42:56 +00:00
core/dao: remove unnecessary slice type
It is used only once, so a simple `sort.Slice` invocation will suffice.
This commit is contained in:
parent
030b7754ad
commit
a71cd0961e
2 changed files with 1 additions and 9 deletions
|
@ -537,7 +537,7 @@ func (dao *Simple) GetHeaderHashes() ([]util.Uint256, error) {
|
|||
for k := range hashMap {
|
||||
sortedKeys = append(sortedKeys, k)
|
||||
}
|
||||
sort.Sort(slice(sortedKeys))
|
||||
sort.Slice(sortedKeys, func(i, j int) bool { return sortedKeys[i] < sortedKeys[j] })
|
||||
|
||||
for _, key := range sortedKeys {
|
||||
hashes = append(hashes[:key], hashMap[key]...)
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package dao
|
||||
|
||||
// slice attaches the methods of Interface to []int, sorting in increasing order.
|
||||
type slice []uint32
|
||||
|
||||
func (p slice) Len() int { return len(p) }
|
||||
func (p slice) Less(i, j int) bool { return p[i] < p[j] }
|
||||
func (p slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
Loading…
Reference in a new issue