Skip to content

Commit 9f14831

Browse files
committed
refactor: omit unnecessary reassignment
Signed-off-by: quantpoet <[email protected]>
1 parent 73b6886 commit 9f14831

File tree

11 files changed

+0
-15
lines changed

11 files changed

+0
-15
lines changed

cmd/pics/state.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ func stateDatabaseComparison(first kv.RwDB, second kv.RwDB, number int) error {
141141
if err = second.View(context.Background(), func(readTx kv.Tx) error {
142142
return first.View(context.Background(), func(firstTx kv.Tx) error {
143143
for bucketName := range bucketLabels {
144-
bucketName := bucketName
145144
if err := readTx.ForEach(bucketName, nil, func(k, v []byte) error {
146145
if firstV, _ := firstTx.GetOne(bucketName, k); firstV != nil && bytes.Equal(v, firstV) {
147146
// Skip the record that is the same as in the first Db

core/state/intra_block_state_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ func (test *snapshotTest) run(t *testing.T) bool {
275275
// checkEqual checks that methods of state and checkstate return the same values.
276276
func (test *snapshotTest) checkEqual(state, checkstate *IntraBlockState) error {
277277
for _, addr := range test.addrs {
278-
addr := addr // pin
279278
var err error
280279
checkeq := func(op string, a, b interface{}) bool {
281280
if err == nil && !reflect.DeepEqual(a, b) {

core/state/rw_v3.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ func (rs *ParallelExecutionState) applyState(txTask *TxTask, domains *dbstate.Sh
150150

151151
emptyRemoval := txTask.Rules.IsSpuriousDragon
152152
for addr, increase := range txTask.BalanceIncreaseSet {
153-
increase := increase
154153
addrBytes := addr.Bytes()
155154
enc0, step0, err := domains.GetLatest(kv.AccountsDomain, rs.tx, addrBytes)
156155
if err != nil {

core/vm/gas_table_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ func testTemporalTxSD(t *testing.T) (kv.TemporalRwTx, *dbstate.SharedDomains) {
111111

112112
func TestEIP2200(t *testing.T) {
113113
for i, tt := range eip2200Tests {
114-
tt := tt
115-
i := i
116114

117115
t.Run(strconv.Itoa(i), func(t *testing.T) {
118116
t.Parallel()

db/downloader/util.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ func BuildTorrentFilesIfNeed(ctx context.Context, dirs datadir.Dirs, torrentFile
197197
var createdAmount atomic.Int32
198198

199199
for _, file := range files {
200-
file := file
201200

202201
if ignore.Contains(file) {
203202
i.Add(1)

db/kv/mdbx/kv_abstract_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ func TestSequence(t *testing.T) {
5151
ctx := context.Background()
5252

5353
for _, db := range writeDBs {
54-
db := db
5554
tx, err := db.BeginRw(ctx)
5655
require.NoError(t, err)
5756
defer tx.Rollback()
@@ -114,7 +113,6 @@ func TestManagedTx(t *testing.T) {
114113
ctx := context.Background()
115114

116115
for _, db := range writeDBs {
117-
db := db
118116
tx, err := db.BeginRw(ctx)
119117
require.NoError(t, err)
120118
defer tx.Rollback()
@@ -142,7 +140,6 @@ func TestManagedTx(t *testing.T) {
142140
}
143141

144142
for _, db := range readDBs {
145-
db := db
146143
msg := fmt.Sprintf("%T", db)
147144
switch db.(type) {
148145
case *remotedb.DB:

db/snapshotsync/freezeblocks/block_reader.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,6 @@ func (r *BlockReader) IterateFrozenBodies(f func(blockNum, baseTxNum, txCount ui
12411241
view := r.sn.View()
12421242
defer view.Close()
12431243
for _, sn := range view.Bodies() {
1244-
sn := sn
12451244
defer sn.Src().MadvSequential().DisableReadAhead()
12461245

12471246
var buf []byte

db/state/aggregator.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,13 @@ func (a *Aggregator) Close() {
397397
func (a *Aggregator) closeDirtyFiles() {
398398
wg := &sync.WaitGroup{}
399399
for _, d := range a.d {
400-
d := d
401400
wg.Add(1)
402401
go func() {
403402
defer wg.Done()
404403
d.Close()
405404
}()
406405
}
407406
for _, ii := range a.iis {
408-
ii := ii
409407
wg.Add(1)
410408
go func() {
411409
defer wg.Done()

db/state/dirty_files.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ func (ii *InvertedIndex) openDirtyFiles() error {
498498
invalidFileItemsLock := sync.Mutex{}
499499
ii.dirtyFiles.Walk(func(items []*FilesItem) bool {
500500
for _, item := range items {
501-
item := item
502501
fromStep, toStep := kv.Step(item.startTxNum/ii.stepSize), kv.Step(item.endTxNum/ii.stepSize)
503502
if item.decompressor == nil {
504503
fPathPattern := ii.efFilePathMask(fromStep, toStep)

db/state/history.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ func (h *History) buildVI(ctx context.Context, historyIdxPath string, hist, efHi
349349
func (h *History) BuildMissedAccessors(ctx context.Context, g *errgroup.Group, ps *background.ProgressSet, historyFiles *MissedAccessorHistoryFiles) {
350350
h.InvertedIndex.BuildMissedAccessors(ctx, g, ps, historyFiles.ii)
351351
for _, item := range historyFiles.missedMapAccessors() {
352-
item := item
353352
g.Go(func() error {
354353
return h.buildVi(ctx, item, ps)
355354
})

0 commit comments

Comments
 (0)