From bacaeefed7dc35011e976d85d87069410bca0df0 Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 16 Oct 2023 17:19:16 +0800 Subject: [PATCH] chore: slice loop replace Signed-off-by: guoguangwu --- app/app_upgrade_test.go | 4 +--- libs/cosmos-sdk/store/rootmulti/rootmulti_store.go | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/app/app_upgrade_test.go b/app/app_upgrade_test.go index f783162337..fefe7d4d81 100644 --- a/app/app_upgrade_test.go +++ b/app/app_upgrade_test.go @@ -238,9 +238,7 @@ func (s2 *simpleAppModule) EndBlock(s sdk.Context, block abci.RequestEndBlock) [ func setupModuleBasics(bs ...module.AppModule) *module.Manager { basis := []module.AppModule{} - for _, v := range bs { - basis = append(basis, v) - } + basis = append(basis, bs...) return module.NewManager( basis..., ) diff --git a/libs/cosmos-sdk/store/rootmulti/rootmulti_store.go b/libs/cosmos-sdk/store/rootmulti/rootmulti_store.go index 60a22094e4..f3cc6884aa 100644 --- a/libs/cosmos-sdk/store/rootmulti/rootmulti_store.go +++ b/libs/cosmos-sdk/store/rootmulti/rootmulti_store.go @@ -1504,9 +1504,7 @@ func (src Store) Copy() *Store { StoreInfos: make([]storeInfo, 0), } - for _, info := range src.lastCommitInfo.StoreInfos { - dst.lastCommitInfo.StoreInfos = append(dst.lastCommitInfo.StoreInfos, info) - } + dst.lastCommitInfo.StoreInfos = append(dst.lastCommitInfo.StoreInfos, src.lastCommitInfo.StoreInfos...) for key, value := range src.storesParams { dst.storesParams[key] = value @@ -1520,13 +1518,9 @@ func (src Store) Copy() *Store { dst.keysByName[key] = value } - for _, value := range src.pruneHeights { - dst.pruneHeights = append(dst.pruneHeights, value) - } + dst.pruneHeights = append(dst.pruneHeights, src.pruneHeights...) - for _, value := range src.versions { - dst.versions = append(dst.versions, value) - } + dst.versions = append(dst.versions, src.versions...) return dst }