go.tools/cmd/stringer: delete needless subtraction of zero in generated code
LGTM=gri R=gri CC=golang-codereviews https://golang.org/cl/136270043
This commit is contained in:
parent
d0448f16e3
commit
d03e8a67df
|
|
@ -203,7 +203,6 @@ var (
|
|||
func (i Unum) String() string {
|
||||
switch {
|
||||
case 0 <= i && i <= 2:
|
||||
i -= 0
|
||||
lo := uint8(0)
|
||||
if i > 0 {
|
||||
lo = _Unum_index_0[i-1]
|
||||
|
|
|
|||
|
|
@ -611,7 +611,9 @@ func (g *Generator) buildMultipleRuns(runs [][]Value, typeName string) {
|
|||
continue
|
||||
}
|
||||
g.Printf("\tcase %s <= i && i <= %s:\n", &values[0], &values[len(values)-1])
|
||||
g.Printf("\t\ti -= %s\n", &values[0])
|
||||
if values[0].value != 0 {
|
||||
g.Printf("\t\ti -= %s\n", &values[0])
|
||||
}
|
||||
g.Printf("\t\tlo := uint%d(0)\n", usize(len(values)))
|
||||
g.Printf("\t\tif i > 0 {\n")
|
||||
g.Printf("\t\t\tlo = _%s_index_%d[i-1]\n", typeName, i)
|
||||
|
|
|
|||
Loading…
Reference in New Issue