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
This commit is contained in:
Alex Prut 2021-02-02 10:32:44 +01:00 committed by GitHub
parent 4eae0c6b6f
commit ef84da8481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 23 additions and 23 deletions

@ -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{

@ -425,7 +425,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)

@ -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
}

@ -38,7 +38,7 @@ type trieKV struct {
type (
// trieGeneratorFn is the interface of trie generation which can
// be implemented by different trie algorithm.
trieGeneratorFn func(in chan (trieKV), out chan (common.Hash))
trieGeneratorFn func(in chan trieKV, out chan common.Hash)
// leafCallbackFn is the callback invoked at the leaves of the trie,
// returns the subtrie root with the specified subtrie identifier.
@ -266,7 +266,7 @@ func generateTrieRoot(it Iterator, account common.Hash, generatorFn trieGenerato
// stdGenerate is a very basic hexary trie builder which uses the same Trie
// as the rest of geth, with no enhancements or optimizations
func stdGenerate(in chan (trieKV), out chan (common.Hash)) {
func stdGenerate(in chan trieKV, out chan common.Hash) {
t, _ := trie.New(common.Hash{}, trie.NewDatabase(memorydb.New()))
for leaf := range in {
t.TryUpdate(leaf.key[:], leaf.value)

@ -500,7 +500,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),
@ -516,7 +516,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),

@ -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)

@ -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.

@ -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]
}
}

@ -31,7 +31,7 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
duktape "gopkg.in/olebedev/go-duktape.v3"
"gopkg.in/olebedev/go-duktape.v3"
)
// bigIntegerJS is the minified version of https://github.com/peterolson/BigInteger.js.

@ -31,5 +31,5 @@ func getProcessCPUTime() int64 {
log.Warn("Failed to retrieve CPU time", "err", err)
return 0
}
return int64(usage.Utime.Sec+usage.Stime.Sec)*100 + int64(usage.Utime.Usec+usage.Stime.Usec)/10000 //nolint:unconvert
return (usage.Utime.Sec+usage.Stime.Sec)*100 + int64(usage.Utime.Usec+usage.Stime.Usec)/10000 //nolint:unconvert
}

@ -128,7 +128,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())
}

@ -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)
}
}

@ -82,11 +82,11 @@ func (f *FullService) Stop() error { return nil }
func (f *FullService) Protocols() []p2p.Protocol {
return []p2p.Protocol{
p2p.Protocol{
{
Name: "test1",
Version: uint(1),
},
p2p.Protocol{
{
Name: "test2",
Version: uint(2),
},

@ -439,7 +439,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)

@ -322,7 +322,7 @@ func TestLargeValue(t *testing.T) {
// TestRandomCases tests som cases that were found via random fuzzing
func TestRandomCases(t *testing.T) {
var rt []randTestStep = []randTestStep{
var rt = []randTestStep{
{op: 6, key: common.Hex2Bytes(""), value: common.Hex2Bytes("")}, // step 0
{op: 6, key: common.Hex2Bytes(""), value: common.Hex2Bytes("")}, // step 1
{op: 0, key: common.Hex2Bytes("d51b182b95d677e5f1c82508c0228de96b73092d78ce78b2230cd948674f66fd1483bd"), value: common.Hex2Bytes("0000000000000002")}, // step 2