diff --git a/cmd/stringer/golden_test.go b/cmd/stringer/golden_test.go index 709ae08e..f0db09f0 100644 --- a/cmd/stringer/golden_test.go +++ b/cmd/stringer/golden_test.go @@ -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] diff --git a/cmd/stringer/stringer.go b/cmd/stringer/stringer.go index 02d51a1a..adc96343 100644 --- a/cmd/stringer/stringer.go +++ b/cmd/stringer/stringer.go @@ -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)