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
# Conflicts:
#	core/state/snapshot/conversion.go
#	eth/tracers/tracer.go
#	metrics/cpu_syscall.go
#	trie/trie_test.go
This commit is contained in:
Alex Prut 2021-02-02 10:32:44 +01:00 committed by Igor Mandrigin
parent a0af38304e
commit 1fb76cca04
10 changed files with 16 additions and 16 deletions

View File

@ -262,7 +262,7 @@ func (ac *accountCache) scanAccounts() error {
switch {
case err != nil:
log.Debug("Failed to decode keystore key", "path", path, "err", err)
case (addr == common.Address{}):
case addr == common.Address{}:
log.Debug("Failed to decode keystore key", "path", path, "err", "missing or zero address")
default:
return &accounts.Account{

View File

@ -427,7 +427,7 @@ func newParityChainSpec(network string, genesis *core.Genesis, bootnodes []strin
spec.Params.EIP98Transition = math.MaxInt64
spec.Genesis.Seal.Ethereum.Nonce = types.EncodeNonce(genesis.Nonce)
spec.Genesis.Seal.Ethereum.MixHash = (genesis.Mixhash[:])
spec.Genesis.Seal.Ethereum.MixHash = genesis.Mixhash[:]
spec.Genesis.Difficulty = (*hexutil.Big)(genesis.Difficulty)
spec.Genesis.Author = genesis.Coinbase
spec.Genesis.Timestamp = (hexutil.Uint64)(genesis.Timestamp)

View File

@ -259,7 +259,7 @@ func (w *wizard) manageGenesis() {
// Export the native genesis spec used by puppeth and Geth
gethJson := filepath.Join(folder, fmt.Sprintf("%s.json", w.network))
if err := ioutil.WriteFile((gethJson), out, 0644); err != nil {
if err := ioutil.WriteFile(gethJson, out, 0644); err != nil {
log.Error("Failed to save genesis file", "err", err)
return
}

View File

@ -533,7 +533,7 @@ func DisabledTestEipExampleCases(t *testing.T) {
{
code := []byte{
byte(vm.PUSH9), 0x00, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, (4 + 8),
byte(vm.PUSH9), 0x00, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, 4 + 8,
byte(vm.JUMPSUB),
byte(vm.STOP),
byte(vm.BEGINSUB),
@ -549,7 +549,7 @@ func DisabledTestEipExampleCases(t *testing.T) {
// out the trace.
{
code := []byte{
byte(vm.PUSH9), 0x01, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, (4 + 8),
byte(vm.PUSH9), 0x01, 0x00, 0x00, 0x00, 0x0, 0x00, 0x00, 0x00, 4 + 8,
byte(vm.JUMPSUB),
byte(vm.STOP),
byte(vm.BEGINSUB),

View File

@ -5,7 +5,7 @@ import (
"math/big"
)
var fuz int = 10
var fuz = 10
func randScalar(max *big.Int) *big.Int {
a, _ := rand.Int(rand.Reader, max)

View File

@ -46,7 +46,7 @@ func parsePrivateKey(key string) (k ed25519.PrivateKey, header []byte, keyNum []
if string(keydata[:2]) != "Ed" {
return nil, nil, nil, errInvalidKeyHeader
}
return ed25519.PrivateKey(keydata[40:]), keydata[:2], keydata[32:40], nil
return keydata[40:], keydata[:2], keydata[32:40], nil
}
// SignFile creates a signature of the input file.

View File

@ -1494,7 +1494,7 @@ func (s *Syncer) revertTrienodeHealRequest(req *trienodeHealRequest) {
// retrievals as not-pending, ready for resheduling
req.timeout.Stop()
for i, hash := range req.hashes {
req.task.trieTasks[hash] = [][]byte(req.paths[i])
req.task.trieTasks[hash] = req.paths[i]
}
}

View File

@ -136,7 +136,7 @@ func (exp *exp) publishMeter(name string, metric metrics.Meter) {
exp.getInt(name + ".count").Set(m.Count())
exp.getFloat(name + ".one-minute").Set(m.Rate1())
exp.getFloat(name + ".five-minute").Set(m.Rate5())
exp.getFloat(name + ".fifteen-minute").Set((m.Rate15()))
exp.getFloat(name + ".fifteen-minute").Set(m.Rate15())
exp.getFloat(name + ".mean").Set(m.RateMean())
}

View File

@ -12,27 +12,27 @@ func BenchmarkGuageFloat64(b *testing.B) {
func TestGaugeFloat64(t *testing.T) {
g := NewGaugeFloat64()
g.Update(float64(47.0))
if v := g.Value(); float64(47.0) != v {
g.Update(47.0)
if v := g.Value(); 47.0 != v {
t.Errorf("g.Value(): 47.0 != %v\n", v)
}
}
func TestGaugeFloat64Snapshot(t *testing.T) {
g := NewGaugeFloat64()
g.Update(float64(47.0))
g.Update(47.0)
snapshot := g.Snapshot()
g.Update(float64(0))
if v := snapshot.Value(); float64(47.0) != v {
if v := snapshot.Value(); 47.0 != v {
t.Errorf("g.Value(): 47.0 != %v\n", v)
}
}
func TestGetOrRegisterGaugeFloat64(t *testing.T) {
r := NewRegistry()
NewRegisteredGaugeFloat64("foo", r).Update(float64(47.0))
NewRegisteredGaugeFloat64("foo", r).Update(47.0)
t.Logf("registry: %v", r)
if g := GetOrRegisterGaugeFloat64("foo", r); float64(47.0) != g.Value() {
if g := GetOrRegisterGaugeFloat64("foo", r); 47.0 != g.Value() {
t.Fatal(g)
}
}

View File

@ -441,7 +441,7 @@ func (api *SignerAPI) newAccount() (common.Address, error) {
continue
}
if pwErr := ValidatePasswordFormat(resp.Text); pwErr != nil {
api.UI.ShowError(fmt.Sprintf("Account creation attempt #%d failed due to password requirements: %v", (i + 1), pwErr))
api.UI.ShowError(fmt.Sprintf("Account creation attempt #%d failed due to password requirements: %v", i+1, pwErr))
} else {
// No error
acc, err := be[0].(*keystore.KeyStore).NewAccount(resp.Text)