diff options
author | Furkan KAMACI <furkankamaci@gmail.com> | 2018-01-03 20:14:47 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-01-03 20:14:47 +0800 |
commit | b8caba97099ee5eed33c3b80dd4ea540722e7d8f (patch) | |
tree | 36c3661d083d81bc52676ff9a030f6e02c91b29c | |
parent | 9d48dbf5c2d0401042134d94997be1850bf8499b (diff) | |
download | dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.tar dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.tar.gz dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.tar.bz2 dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.tar.lz dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.tar.xz dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.tar.zst dexon-b8caba97099ee5eed33c3b80dd4ea540722e7d8f.zip |
various: remove redundant parentheses (#15793)
-rw-r--r-- | accounts/abi/argument.go | 2 | ||||
-rw-r--r-- | cmd/swarm/config.go | 2 | ||||
-rw-r--r-- | common/bitutil/bitutil.go | 8 | ||||
-rw-r--r-- | crypto/ecies/ecies.go | 2 | ||||
-rw-r--r-- | eth/handler.go | 4 | ||||
-rw-r--r-- | les/handler.go | 4 | ||||
-rw-r--r-- | les/serverpool.go | 2 | ||||
-rw-r--r-- | swarm/storage/chunker_test.go | 8 | ||||
-rw-r--r-- | swarm/storage/pyramid.go | 2 | ||||
-rw-r--r-- | trie/trie.go | 2 | ||||
-rw-r--r-- | whisper/whisperv5/filter_test.go | 4 | ||||
-rw-r--r-- | whisper/whisperv6/filter_test.go | 4 |
12 files changed, 22 insertions, 22 deletions
diff --git a/accounts/abi/argument.go b/accounts/abi/argument.go index 4540c342f..04ca6150a 100644 --- a/accounts/abi/argument.go +++ b/accounts/abi/argument.go @@ -202,7 +202,7 @@ func (arguments Arguments) Pack(args ...interface{}) ([]byte, error) { inputOffset := 0 for _, abiArg := range abiArgs { if abiArg.Type.T == ArrayTy { - inputOffset += (32 * abiArg.Type.Size) + inputOffset += 32 * abiArg.Type.Size } else { inputOffset += 32 } diff --git a/cmd/swarm/config.go b/cmd/swarm/config.go index 33235ca06..29b5faefa 100644 --- a/cmd/swarm/config.go +++ b/cmd/swarm/config.go @@ -315,7 +315,7 @@ func checkDeprecated(ctx *cli.Context) { func printConfig(config *bzzapi.Config) string { out, err := tomlSettings.Marshal(&config) if err != nil { - return (fmt.Sprintf("Something is not right with the configuration: %v", err)) + return fmt.Sprintf("Something is not right with the configuration: %v", err) } return string(out) } diff --git a/common/bitutil/bitutil.go b/common/bitutil/bitutil.go index 117616543..cd3e72169 100644 --- a/common/bitutil/bitutil.go +++ b/common/bitutil/bitutil.go @@ -40,7 +40,7 @@ func fastXORBytes(dst, a, b []byte) int { dw[i] = aw[i] ^ bw[i] } } - for i := (n - n%wordSize); i < n; i++ { + for i := n - n%wordSize; i < n; i++ { dst[i] = a[i] ^ b[i] } return n @@ -84,7 +84,7 @@ func fastANDBytes(dst, a, b []byte) int { dw[i] = aw[i] & bw[i] } } - for i := (n - n%wordSize); i < n; i++ { + for i := n - n%wordSize; i < n; i++ { dst[i] = a[i] & b[i] } return n @@ -128,7 +128,7 @@ func fastORBytes(dst, a, b []byte) int { dw[i] = aw[i] | bw[i] } } - for i := (n - n%wordSize); i < n; i++ { + for i := n - n%wordSize; i < n; i++ { dst[i] = a[i] | b[i] } return n @@ -168,7 +168,7 @@ func fastTestBytes(p []byte) bool { } } } - for i := (n - n%wordSize); i < n; i++ { + for i := n - n%wordSize; i < n; i++ { if p[i] != 0 { return true } diff --git a/crypto/ecies/ecies.go b/crypto/ecies/ecies.go index 1d5f96ed2..2ed91c895 100644 --- a/crypto/ecies/ecies.go +++ b/crypto/ecies/ecies.go @@ -314,7 +314,7 @@ func (prv *PrivateKey) Decrypt(rand io.Reader, c, s1, s2 []byte) (m []byte, err switch c[0] { case 2, 3, 4: - rLen = ((prv.PublicKey.Curve.Params().BitSize + 7) / 4) + rLen = (prv.PublicKey.Curve.Params().BitSize + 7) / 4 if len(c) < (rLen + hLen + 1) { err = ErrInvalidMessage return diff --git a/eth/handler.go b/eth/handler.go index 31c311687..074cffd96 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -394,14 +394,14 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { case query.Reverse: // Number based traversal towards the genesis block if query.Origin.Number >= query.Skip+1 { - query.Origin.Number -= (query.Skip + 1) + query.Origin.Number -= query.Skip + 1 } else { unknown = true } case !query.Reverse: // Number based traversal towards the leaf block - query.Origin.Number += (query.Skip + 1) + query.Origin.Number += query.Skip + 1 } } return p.SendBlockHeaders(headers) diff --git a/les/handler.go b/les/handler.go index f8cf63952..e310942ba 100644 --- a/les/handler.go +++ b/les/handler.go @@ -454,14 +454,14 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { case query.Reverse: // Number based traversal towards the genesis block if query.Origin.Number >= query.Skip+1 { - query.Origin.Number -= (query.Skip + 1) + query.Origin.Number -= query.Skip + 1 } else { unknown = true } case !query.Reverse: // Number based traversal towards the leaf block - query.Origin.Number += (query.Skip + 1) + query.Origin.Number += query.Skip + 1 } } diff --git a/les/serverpool.go b/les/serverpool.go index dc1ea6bf0..a84c29c3a 100644 --- a/les/serverpool.go +++ b/les/serverpool.go @@ -618,7 +618,7 @@ func (e *knownEntry) Weight() int64 { if e.state != psNotConnected || !e.known || e.delayedRetry { return 0 } - return int64(1000000000 * e.connectStats.recentAvg() * math.Exp(-float64(e.lastConnected.fails)*failDropLn-e.responseStats.recentAvg()/float64(responseScoreTC)-e.delayStats.recentAvg()/float64(delayScoreTC)) * math.Pow((1-e.timeoutStats.recentAvg()), timeoutPow)) + return int64(1000000000 * e.connectStats.recentAvg() * math.Exp(-float64(e.lastConnected.fails)*failDropLn-e.responseStats.recentAvg()/float64(responseScoreTC)-e.delayStats.recentAvg()/float64(delayScoreTC)) * math.Pow(1-e.timeoutStats.recentAvg(), timeoutPow)) } // poolEntryAddress is a separate object because currently it is necessary to remember diff --git a/swarm/storage/chunker_test.go b/swarm/storage/chunker_test.go index 6178a7bb1..6b828970b 100644 --- a/swarm/storage/chunker_test.go +++ b/swarm/storage/chunker_test.go @@ -60,7 +60,7 @@ func (self *chunkerTester) Split(chunker Splitter, data io.Reader, size int64, c for { select { case <-timeout: - return errors.New(("Split timeout error")) + return errors.New("Split timeout error") case <-quitC: return nil case chunk := <-chunkC: @@ -97,7 +97,7 @@ func (self *chunkerTester) Append(chunker Splitter, rootKey Key, data io.Reader, for { select { case <-timeout: - return errors.New(("Append timeout error")) + return errors.New("Append timeout error") case <-quitC: return nil case chunk := <-chunkC: @@ -146,7 +146,7 @@ func (self *chunkerTester) Join(chunker Chunker, key Key, c int, chunkC chan *Ch for { select { case <-timeout: - return errors.New(("Join timeout error")) + return errors.New("Join timeout error") case chunk, ok := <-chunkC: if !ok { close(quitC) @@ -155,7 +155,7 @@ func (self *chunkerTester) Join(chunker Chunker, key Key, c int, chunkC chan *Ch // this just mocks the behaviour of a chunk store retrieval stored, success := self.chunks[chunk.Key.String()] if !success { - return errors.New(("Not found")) + return errors.New("Not found") } chunk.SData = stored.SData chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8])) diff --git a/swarm/storage/pyramid.go b/swarm/storage/pyramid.go index f2e85cb5b..19d493405 100644 --- a/swarm/storage/pyramid.go +++ b/swarm/storage/pyramid.go @@ -338,7 +338,7 @@ func (self *PyramidChunker) loadTree(chunkLevel [][]*TreeEntry, key Key, chunkC chunkLevel[depth-1] = append(chunkLevel[depth-1], newEntry) // Add the rest of the tree - for lvl := (depth - 1); lvl >= 1; lvl-- { + for lvl := depth - 1; lvl >= 1; lvl-- { //TODO(jmozah): instead of loading finished branches and then trim in the end, //avoid loading them in the first place diff --git a/trie/trie.go b/trie/trie.go index c211e7554..7c1b5e1b6 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -489,7 +489,7 @@ func (t *Trie) Commit() (root common.Hash, err error) { func (t *Trie) CommitTo(db DatabaseWriter) (root common.Hash, err error) { hash, cached, err := t.hashRoot(db) if err != nil { - return (common.Hash{}), err + return common.Hash{}, err } t.root = cached t.cachegen++ diff --git a/whisper/whisperv5/filter_test.go b/whisper/whisperv5/filter_test.go index bd35e7f20..72568b94e 100644 --- a/whisper/whisperv5/filter_test.go +++ b/whisper/whisperv5/filter_test.go @@ -88,7 +88,7 @@ func generateTestCases(t *testing.T, SizeTestFilters int) []FilterTestCase { for i := 0; i < SizeTestFilters; i++ { f, _ := generateFilter(t, true) cases[i].f = f - cases[i].alive = (mrand.Int()&int(1) == 0) + cases[i].alive = mrand.Int()&int(1) == 0 } return cases } @@ -122,7 +122,7 @@ func TestInstallFilters(t *testing.T) { for i, testCase := range tst { fil := filters.Get(testCase.id) - exist := (fil != nil) + exist := fil != nil if exist != testCase.alive { t.Fatalf("seed %d: failed alive: %d, %v, %v", seed, i, exist, testCase.alive) } diff --git a/whisper/whisperv6/filter_test.go b/whisper/whisperv6/filter_test.go index dd0de0f6e..e2877b233 100644 --- a/whisper/whisperv6/filter_test.go +++ b/whisper/whisperv6/filter_test.go @@ -88,7 +88,7 @@ func generateTestCases(t *testing.T, SizeTestFilters int) []FilterTestCase { for i := 0; i < SizeTestFilters; i++ { f, _ := generateFilter(t, true) cases[i].f = f - cases[i].alive = (mrand.Int()&int(1) == 0) + cases[i].alive = mrand.Int()&int(1) == 0 } return cases } @@ -122,7 +122,7 @@ func TestInstallFilters(t *testing.T) { for i, testCase := range tst { fil := filters.Get(testCase.id) - exist := (fil != nil) + exist := fil != nil if exist != testCase.alive { t.Fatalf("seed %d: failed alive: %d, %v, %v", seed, i, exist, testCase.alive) } |