1
0
mirror of https://github.com/golang/go synced 2024-11-22 08:34:40 -07:00

fmt: Remove some unnecessary conversions.

R=golang-dev, remyoudompheng
CC=golang-dev
https://golang.org/cl/12795052
This commit is contained in:
Robin Eklind 2013-08-28 11:55:39 -07:00 committed by Brad Fitzpatrick
parent 8159b6901f
commit cfb02f7b74

View File

@ -774,7 +774,7 @@ func (p *pp) printArg(arg interface{}, verb rune, plus, goSyntax bool, depth int
case float64: case float64:
p.fmtFloat64(f, verb) p.fmtFloat64(f, verb)
case complex64: case complex64:
p.fmtComplex64(complex64(f), verb) p.fmtComplex64(f, verb)
case complex128: case complex128:
p.fmtComplex128(f, verb) p.fmtComplex128(f, verb)
case int: case int:
@ -867,18 +867,18 @@ BigSwitch:
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
p.fmtInt64(f.Int(), verb) p.fmtInt64(f.Int(), verb)
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
p.fmtUint64(uint64(f.Uint()), verb, goSyntax) p.fmtUint64(f.Uint(), verb, goSyntax)
case reflect.Float32, reflect.Float64: case reflect.Float32, reflect.Float64:
if f.Type().Size() == 4 { if f.Type().Size() == 4 {
p.fmtFloat32(float32(f.Float()), verb) p.fmtFloat32(float32(f.Float()), verb)
} else { } else {
p.fmtFloat64(float64(f.Float()), verb) p.fmtFloat64(f.Float(), verb)
} }
case reflect.Complex64, reflect.Complex128: case reflect.Complex64, reflect.Complex128:
if f.Type().Size() == 8 { if f.Type().Size() == 8 {
p.fmtComplex64(complex64(f.Complex()), verb) p.fmtComplex64(complex64(f.Complex()), verb)
} else { } else {
p.fmtComplex128(complex128(f.Complex()), verb) p.fmtComplex128(f.Complex(), verb)
} }
case reflect.String: case reflect.String:
p.fmtString(f.String(), verb, goSyntax) p.fmtString(f.String(), verb, goSyntax)