Skip to content

Commit ada7473

Browse files
cuishuangcherrymui
authored andcommitted
all: remove redundant type conversion
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>
1 parent 1bdb400 commit ada7473

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

encoding/internal/enctest/enctest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestEncoding(t *testing.T, e encoding.Encoding, encoded, utf8, prefix, suff
6666
// regardless of whatever wPrefix is.
6767
continue
6868
}
69-
got1, want1 := string(g), wPrefix+strings.Repeat(want, n)+wSuffix
69+
got1, want1 := g, wPrefix+strings.Repeat(want, n)+wSuffix
7070
if got1 != want1 {
7171
t.Fatalf("ReadAll: n=%d\ngot %q\nwant %q",
7272
n, trim(got1), trim(want1))

internal/ucd/ucd.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,28 +317,28 @@ func (p *Parser) Bool(i int) bool {
317317

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

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

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

339339
// String parses and returns field i as a string value.
340340
func (p *Parser) String(i int) string {
341-
return string(p.getField(i))
341+
return p.getField(i)
342342
}
343343

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

0 commit comments

Comments
 (0)