Skip to content

Commit

Permalink
all: remove redundant type conversion
Browse files Browse the repository at this point in the history
Change-Id: Ie059c983bcb3cd6bce7b2097720cbee899abf771
GitHub-Last-Rev: ce45699
GitHub-Pull-Request: #33
Reviewed-on: https://go-review.googlesource.com/c/text/+/429059
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
  • Loading branch information
cuishuang authored and cherrymui committed Nov 9, 2022
1 parent 1bdb400 commit ada7473
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion encoding/internal/enctest/enctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestEncoding(t *testing.T, e encoding.Encoding, encoded, utf8, prefix, suff
// regardless of whatever wPrefix is.
continue
}
got1, want1 := string(g), wPrefix+strings.Repeat(want, n)+wSuffix
got1, want1 := g, wPrefix+strings.Repeat(want, n)+wSuffix
if got1 != want1 {
t.Fatalf("ReadAll: n=%d\ngot %q\nwant %q",
n, trim(got1), trim(want1))
Expand Down
8 changes: 4 additions & 4 deletions internal/ucd/ucd.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,28 +317,28 @@ func (p *Parser) Bool(i int) bool {

// Int parses and returns field i as an integer value.
func (p *Parser) Int(i int) int {
x, err := strconv.ParseInt(string(p.getField(i)), 10, 64)
x, err := strconv.ParseInt(p.getField(i), 10, 64)
p.setError(err, "error parsing int")
return int(x)
}

// Uint parses and returns field i as an unsigned integer value.
func (p *Parser) Uint(i int) uint {
x, err := strconv.ParseUint(string(p.getField(i)), 10, 64)
x, err := strconv.ParseUint(p.getField(i), 10, 64)
p.setError(err, "error parsing uint")
return uint(x)
}

// Float parses and returns field i as a decimal value.
func (p *Parser) Float(i int) float64 {
x, err := strconv.ParseFloat(string(p.getField(i)), 64)
x, err := strconv.ParseFloat(p.getField(i), 64)
p.setError(err, "error parsing float")
return x
}

// String parses and returns field i as a string value.
func (p *Parser) String(i int) string {
return string(p.getField(i))
return p.getField(i)
}

// Strings parses and returns field i as a space-separated list of strings.
Expand Down

0 comments on commit ada7473

Please sign in to comment.