aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/nodes_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/cmd/compile/internal/syntax/nodes_test.go
parent5e92c411284f1757c3531a70530170f1079ee5fc (diff)
downloadgo-f22ba1f24786be600bfa3686a7ce5a318a96b9c9.tar.gz
go-f22ba1f24786be600bfa3686a7ce5a318a96b9c9.zip
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/cmd/compile/internal/syntax/nodes_test.go')
-rw-r--r--src/cmd/compile/internal/syntax/nodes_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/syntax/nodes_test.go b/src/cmd/compile/internal/syntax/nodes_test.go
index 1bba9eeacf..9d7beb997f 100644
--- a/src/cmd/compile/internal/syntax/nodes_test.go
+++ b/src/cmd/compile/internal/syntax/nodes_test.go
@@ -313,7 +313,7 @@ func testPos(t *testing.T, list []test, prefix, suffix string, extract func(*Fil
}
func stripAt(s string) (string, int) {
- if i := strings.Index(s, "@"); i >= 0 {
+ if i := strings.IndexByte(s, '@'); i >= 0 {
return s[:i] + s[i+1:], i
}
return s, -1