]> Cypherpunks repositories - gostls13.git/commitdiff
strconv: remove redundant conversions to int
authorsmasher164 <aindurti@gmail.com>
Mon, 27 Apr 2020 17:23:24 +0000 (13:23 -0400)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 27 Apr 2020 21:46:18 +0000 (21:46 +0000)
IntSize is an untyped constant that does not need explicit conversion.
Annotating IntSize as an int and running github.com/mdempsky/unconvert
reveals these two cases.

Fixes #38682.

Change-Id: I014646b7457ddcde32474810153229dcf0c269c6
Reviewed-on: https://go-review.googlesource.com/c/go/+/230306
Run-TryBot: Akhil Indurti <aindurti@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/strconv/atoi.go

index a4a8a37fb4252589370dd9919d7e26ec7f4e35a3..0b82fb09085cb045300102367588594b8363d2d3 100644 (file)
@@ -96,7 +96,7 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) {
        }
 
        if bitSize == 0 {
-               bitSize = int(IntSize)
+               bitSize = IntSize
        } else if bitSize < 0 || bitSize > 64 {
                return 0, bitSizeError(fnParseUint, s0, bitSize)
        }
@@ -203,7 +203,7 @@ func ParseInt(s string, base int, bitSize int) (i int64, err error) {
        }
 
        if bitSize == 0 {
-               bitSize = int(IntSize)
+               bitSize = IntSize
        }
 
        cutoff := uint64(1 << uint(bitSize-1))