Skip to content

Commit ef84da8

Browse files
authored
all: remove unneeded parentheses (#21921)
* remove uneeded convertion type * remove redundant type in composite literal * omit explicit type where implicit * remove unused redundant parenthesis * remove redundant import alias duktape
1 parent 4eae0c6 commit ef84da8

File tree

15 files changed

+23
-23
lines changed

15 files changed

+23
-23
lines changed

accounts/keystore/account_cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ func (ac *accountCache) scanAccounts() error {
262262
switch {
263263
case err != nil:
264264
log.Debug("Failed to decode keystore key", "path", path, "err", err)
265-
case (addr == common.Address{}):
265+
case addr == common.Address{}:
266266
log.Debug("Failed to decode keystore key", "path", path, "err", "missing or zero address")
267267
default:
268268
return &accounts.Account{

cmd/puppeth/genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
425425
spec.Params.EIP98Transition = math.MaxInt64
426426

427427
spec.Genesis.Seal.Ethereum.Nonce = types.EncodeNonce(genesis.Nonce)
428-
spec.Genesis.Seal.Ethereum.MixHash = (genesis.Mixhash[:])
428+
spec.Genesis.Seal.Ethereum.MixHash = genesis.Mixhash[:]
429429
spec.Genesis.Difficulty = (*hexutil.Big)(genesis.Difficulty)
430430
spec.Genesis.Author = genesis.Coinbase
431431
spec.Genesis.Timestamp = (hexutil.Uint64)(genesis.Timestamp)

cmd/puppeth/wizard_genesis.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func (w *wizard) manageGenesis() {
259259

260260
// Export the native genesis spec used by puppeth and Geth
261261
gethJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network))
262-
if err := ioutil.WriteFile((gethJson), out, 0644); err != nil {
262+
if err := ioutil.WriteFile(gethJson, out, 0644); err != nil {
263263
log.Error("Failed to save genesis file", "err", err)
264264
return
265265
}

core/state/snapshot/conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type trieKV struct {
3838
type (
3939
// trieGeneratorFn is the interface of trie generation which can
4040
// be implemented by different trie algorithm.
41-
trieGeneratorFn func(in chan (trieKV), out chan (common.Hash))
41+
trieGeneratorFn func(in chan trieKV, out chan common.Hash)
4242

4343
// leafCallbackFn is the callback invoked at the leaves of the trie,
4444
// returns the subtrie root with the specified subtrie identifier.
@@ -266,7 +266,7 @@ func generateTrieRoot(it Iterator, account common.Hash, generatorFn trieGenerato
266266

267267
// stdGenerate is a very basic hexary trie builder which uses the same Trie
268268
// as the rest of geth, with no enhancements or optimizations
269-
func stdGenerate(in chan (trieKV), out chan (common.Hash)) {
269+
func stdGenerate(in chan trieKV, out chan common.Hash) {
270270
t, _ := trie.New(common.Hash{}, trie.NewDatabase(memorydb.New()))
271271
for leaf := range in {
272272
t.TryUpdate(leaf.key[:], leaf.value)

core/vm/runtime/runtime_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ func DisabledTestEipExampleCases(t *testing.T) {
500500

501501
{
502502
code := []byte{
503-
byte(vm.PUSH9), 0x00, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, (4 + 8),
503+
byte(vm.PUSH9), 0x00, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, 4 + 8,
504504
byte(vm.JUMPSUB),
505505
byte(vm.STOP),
506506
byte(vm.BEGINSUB),
@@ -516,7 +516,7 @@ func DisabledTestEipExampleCases(t *testing.T) {
516516
// out the trace.
517517
{
518518
code := []byte{
519-
byte(vm.PUSH9), 0x01, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, (4 + 8),
519+
byte(vm.PUSH9), 0x01, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, 4 + 8,
520520
byte(vm.JUMPSUB),
521521
byte(vm.STOP),
522522
byte(vm.BEGINSUB),

crypto/bls12381/bls12_381_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"math/big"
66
)
77

8-
var fuz int = 10
8+
var fuz = 10
99

1010
func randScalar(max *big.Int) *big.Int {
1111
a, _ := rand.Int(rand.Reader, max)

crypto/signify/signify.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func parsePrivateKey(key string) (k ed25519.PrivateKey, header []byte, keyNum []
4646
if string(keydata[:2]) != "Ed" {
4747
return nil, nil, nil, errInvalidKeyHeader
4848
}
49-
return ed25519.PrivateKey(keydata[40:]), keydata[:2], keydata[32:40], nil
49+
return keydata[40:], keydata[:2], keydata[32:40], nil
5050
}
5151

5252
// SignFile creates a signature of the input file.

eth/protocols/snap/sync.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ func (s *Syncer) revertTrienodeHealRequest(req *trienodeHealRequest) {
14941494
// retrievals as not-pending, ready for resheduling
14951495
req.timeout.Stop()
14961496
for i, hash := range req.hashes {
1497-
req.task.trieTasks[hash] = [][]byte(req.paths[i])
1497+
req.task.trieTasks[hash] = req.paths[i]
14981498
}
14991499
}
15001500

eth/tracers/tracer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"github.com/ethereum/go-ethereum/core/vm"
3232
"github.com/ethereum/go-ethereum/crypto"
3333
"github.com/ethereum/go-ethereum/log"
34-
duktape "gopkg.in/olebedev/go-duktape.v3"
34+
"gopkg.in/olebedev/go-duktape.v3"
3535
)
3636

3737
// bigIntegerJS is the minified version of https://github.com/peterolson/BigInteger.js.

metrics/cpu_syscall.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ func getProcessCPUTime() int64 {
3131
log.Warn("Failed to retrieve CPU time", "err", err)
3232
return 0
3333
}
34-
return int64(usage.Utime.Sec+usage.Stime.Sec)*100 + int64(usage.Utime.Usec+usage.Stime.Usec)/10000 //nolint:unconvert
34+
return (usage.Utime.Sec+usage.Stime.Sec)*100 + int64(usage.Utime.Usec+usage.Stime.Usec)/10000 //nolint:unconvert
3535
}

0 commit comments

Comments
 (0)