Skip to content

Commit 1515856

Browse files
authored
chore: remove unused local variables (#22340)
1 parent 8fa3090 commit 1515856

File tree

5 files changed

+2
-12
lines changed

5 files changed

+2
-12
lines changed

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,5 @@ linters-settings:
119119
- regexpMust
120120
- appendAssign
121121
- ifElseChain
122+
unused:
123+
local-variables-are-used: false

simapp/export.go

-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []
216216
// update bond intra-tx counters.
217217
store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey))
218218
iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey)
219-
counter := int16(0)
220219

221220
for ; iter.Valid(); iter.Next() {
222221
addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key()))
@@ -238,7 +237,6 @@ func (app *SimApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []
238237
if err = app.StakingKeeper.SetValidator(ctx, validator); err != nil {
239238
panic(err)
240239
}
241-
counter++
242240
}
243241

244242
if err := iter.Close(); err != nil {

store/cachekv/store_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem corestore.KVSt
552552
require.NoError(t, err)
553553

554554
krc := newKeyRangeCounter(r)
555-
i := 0
556555

557556
for ; krc.valid(); krc.next() {
558557
require.True(t, itr.Valid())
@@ -569,7 +568,6 @@ func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem corestore.KVSt
569568

570569
itr.Next()
571570
itr2.Next()
572-
i++
573571
}
574572

575573
require.False(t, itr.Valid())

types/mempool/priority_nonce_test.go

-5
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,8 @@ func (s *MempoolTestSuite) TestRandomTxOrderManyTimes() {
540540
// validateOrder checks that the txs are ordered by priority and nonce
541541
// in O(n^2) time by checking each tx against all the other txs
542542
func validateOrder(mtxs []sdk.Tx) error {
543-
iterations := 0
544543
var itxs []txSpec
545544
for i, mtx := range mtxs {
546-
iterations++
547545
tx := mtx.(testTx)
548546
itxs = append(itxs, txSpec{p: int(tx.priority), n: int(tx.nonce), a: tx.address, i: i})
549547
}
@@ -556,7 +554,6 @@ func validateOrder(mtxs []sdk.Tx) error {
556554

557555
for _, a := range itxs {
558556
for _, b := range itxs {
559-
iterations++
560557
// when b is before a
561558

562559
// when a is before b
@@ -574,7 +571,6 @@ func validateOrder(mtxs []sdk.Tx) error {
574571
// find a tx with same sender as b and lower nonce
575572
found := false
576573
for _, c := range itxs {
577-
iterations++
578574
if c.a.Equals(b.a) && c.n < b.n && c.p <= a.p {
579575
found = true
580576
break
@@ -588,7 +584,6 @@ func validateOrder(mtxs []sdk.Tx) error {
588584
}
589585
}
590586
}
591-
// fmt.Printf("validation in iterations: %d\n", iterations)
592587
return nil
593588
}
594589

x/staking/keeper/query_utils.go

-3
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,9 @@ func (k Keeper) GetDelegatorValidator(
6565
func (k Keeper) GetAllDelegatorDelegations(ctx context.Context, delegator sdk.AccAddress) ([]types.Delegation, error) {
6666
delegations := make([]types.Delegation, 0)
6767

68-
var i int64
6968
rng := collections.NewPrefixedPairRange[sdk.AccAddress, sdk.ValAddress](delegator)
7069
err := k.Delegations.Walk(ctx, rng, func(key collections.Pair[sdk.AccAddress, sdk.ValAddress], del types.Delegation) (stop bool, err error) {
7170
delegations = append(delegations, del)
72-
i++
73-
7471
return false, nil
7572
})
7673
if err != nil {

0 commit comments

Comments
 (0)