summaryrefslogtreecommitdiff
path: root/src/regexp/exec_test.go
diff options
context:
space:
mode:
authorMarvin Stenger <marvin.stenger94@gmail.com>2017-09-21 19:01:27 +0200
committerIan Lance Taylor <iant@golang.org>2017-09-25 17:35:41 +0000
commitf22ba1f24786be600bfa3686a7ce5a318a96b9c9 (patch)
tree06dd4fd49b65d66491a3674f8ed440fd44f52cc5 /src/regexp/exec_test.go
parent5e92c411284f1757c3531a70530170f1079ee5fc (diff)
downloadgo-git-f22ba1f24786be600bfa3686a7ce5a318a96b9c9.tar.gz
all: prefer strings.IndexByte over strings.Index
strings.IndexByte was introduced in go1.2 and it can be used effectively wherever the second argument to strings.Index is exactly one byte long. This avoids generating unnecessary string symbols and saves a few calls to strings.Index. Change-Id: I1ab5edb7c4ee9058084cfa57cbcc267c2597e793 Reviewed-on: https://go-review.googlesource.com/65930 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/regexp/exec_test.go')
-rw-r--r--src/regexp/exec_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/regexp/exec_test.go b/src/regexp/exec_test.go
index 5f8e747b17..5b827a528d 100644
--- a/src/regexp/exec_test.go
+++ b/src/regexp/exec_test.go
@@ -294,7 +294,7 @@ func parseResult(t *testing.T, file string, lineno int, res string) []int {
out[n] = -1
out[n+1] = -1
} else {
- k := strings.Index(pair, "-")
+ k := strings.IndexByte(pair, '-')
if k < 0 {
t.Fatalf("%s:%d: invalid pair %s", file, lineno, pair)
}
@@ -457,7 +457,7 @@ Reading:
continue Reading
}
case ':':
- i := strings.Index(flag[1:], ":")
+ i := strings.IndexByte(flag[1:], ':')
if i < 0 {
t.Logf("skip: %s", line)
continue Reading