diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2018-03-26 06:56:39 +0000 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-03-26 23:05:53 +0000 |
commit | 48db2c01b42d959f2d8fa0c24d853bdb6100cf8a (patch) | |
tree | c80a885e1971c4114d33c25e905def159be7f73c /src/regexp/syntax/parse_test.go | |
parent | f0eca373beb94763b71dadcf6504a95a3797dcbb (diff) | |
download | go-48db2c01b42d959f2d8fa0c24d853bdb6100cf8a.tar.gz go-48db2c01b42d959f2d8fa0c24d853bdb6100cf8a.zip |
all: use strings.Builder instead of bytes.Buffer where appropriate
I grepped for "bytes.Buffer" and "buf.String" and mostly ignored test
files. I skipped a few on purpose and probably missed a few others,
but otherwise I think this should be most of them.
Updates #18990
Change-Id: I5a6ae4296b87b416d8da02d7bfaf981d8cc14774
Reviewed-on: https://go-review.googlesource.com/102479
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/regexp/syntax/parse_test.go')
-rw-r--r-- | src/regexp/syntax/parse_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/regexp/syntax/parse_test.go b/src/regexp/syntax/parse_test.go index dd6529f7c8..fe3d251761 100644 --- a/src/regexp/syntax/parse_test.go +++ b/src/regexp/syntax/parse_test.go @@ -5,8 +5,8 @@ package syntax import ( - "bytes" "fmt" + "strings" "testing" "unicode" ) @@ -282,7 +282,7 @@ func testParseDump(t *testing.T, tests []parseTest, flags Flags) { // dump prints a string representation of the regexp showing // the structure explicitly. func dump(re *Regexp) string { - var b bytes.Buffer + var b strings.Builder dumpRegexp(&b, re) return b.String() } @@ -312,7 +312,7 @@ var opNames = []string{ // dumpRegexp writes an encoding of the syntax tree for the regexp re to b. // It is used during testing to distinguish between parses that might print // the same using re's String method. -func dumpRegexp(b *bytes.Buffer, re *Regexp) { +func dumpRegexp(b *strings.Builder, re *Regexp) { if int(re.Op) >= len(opNames) || opNames[re.Op] == "" { fmt.Fprintf(b, "op%d", re.Op) } else { |