Commit e93eb284 authored by Kevin Burke's avatar Kevin Burke Committed by Brad Fitzpatrick

strings: avoid unnecessary variable setting

We initialize fieldStart to 0, then set it to i without ever reading
0, so we might as well just initialize it to i.

Change-Id: I17905b25d54a62b6bc76f915353756ed5eb6972b
Reviewed-on: https://go-review.googlesource.com/52933Reviewed-by: default avatarMartin Möhrmann <moehrmann@google.com>
Reviewed-by: default avatarAvelino <t@avelino.xxx>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 254f8ea9
...@@ -363,7 +363,6 @@ func Fields(s string) []string { ...@@ -363,7 +363,6 @@ func Fields(s string) []string {
// a non-ASCII rune needs to be decoded and checked // a non-ASCII rune needs to be decoded and checked
// if it corresponds to a space. // if it corresponds to a space.
a := make([]string, 0, n) a := make([]string, 0, n)
fieldStart := 0
i := 0 i := 0
// Skip spaces in the front of the input. // Skip spaces in the front of the input.
for i < len(s) { for i < len(s) {
...@@ -380,7 +379,7 @@ func Fields(s string) []string { ...@@ -380,7 +379,7 @@ func Fields(s string) []string {
i += w i += w
} }
} }
fieldStart = i fieldStart := i
for i < len(s) { for i < len(s) {
if c := s[i]; c < utf8.RuneSelf { if c := s[i]; c < utf8.RuneSelf {
if asciiSpace[c] == 0 { if asciiSpace[c] == 0 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment