refactor(store,x/params): using maps.Copy (#19889)
Co-authored-by: weixie.c <weixie.c@kaitaitech.cn>
This commit is contained in:
parent
f630cfb739
commit
705fad65d8
@ -1,6 +1,6 @@
|
||||
package store
|
||||
|
||||
import "golang.org/x/exp/maps"
|
||||
import "maps"
|
||||
|
||||
// TraceContext contains KVStore context data. It will be written with every
|
||||
// trace operation.
|
||||
@ -17,9 +17,7 @@ func (tc TraceContext) Merge(newTc TraceContext) TraceContext {
|
||||
tc = TraceContext{}
|
||||
}
|
||||
|
||||
for k, v := range newTc {
|
||||
tc[k] = v
|
||||
}
|
||||
maps.Copy(tc, newTc)
|
||||
|
||||
return tc
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"maps"
|
||||
"reflect"
|
||||
|
||||
"cosmossdk.io/store/prefix"
|
||||
@ -57,9 +58,7 @@ func (s Subspace) WithKeyTable(table KeyTable) Subspace {
|
||||
panic("WithKeyTable() called on already initialized Subspace")
|
||||
}
|
||||
|
||||
for k, v := range table.m {
|
||||
s.table.m[k] = v
|
||||
}
|
||||
maps.Copy(s.table.m, table.m)
|
||||
|
||||
// Allocate additional capacity for Subspace.name
|
||||
// So we don't have to allocate extra space each time appending to the key
|
||||
|
||||
Loading…
Reference in New Issue
Block a user