Skip to content

Commit

Permalink
Revert "refactor: use unsafe to avoid alloc"
Browse files Browse the repository at this point in the history
This reverts commit f27ef0c.
  • Loading branch information
wazazaby committed Mar 28, 2024
1 parent 9bc6f27 commit 21e0c13
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions vimebu.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"log"
"strings"
"unsafe"
)

var (
Expand Down Expand Up @@ -317,13 +316,5 @@ func (b *Builder) String() string {
if b.flLabel {
b.underlying.WriteByte(rightBracketByte)
}

return b.unsafeString()
}

// unsafeString returns the accumulated string using
// [strings.Builder]'s unsafe code to reduce allocations.
func (b *Builder) unsafeString() string {
buf := b.underlying
return unsafe.String(unsafe.SliceData(buf.Bytes()), buf.Len())
return b.underlying.String()
}

0 comments on commit 21e0c13

Please sign in to comment.