Skip to content

Commit

Permalink
Use MustWriteByte() where possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Jan 29, 2019
1 parent d7dde33 commit d30a999
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion array.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (vis *visitor) visitArray(w io.Writer, v Value) {

iago.MustWriteString(w, "{\n")
vis.visitArrayValues(indent.NewIndenter(w, vis.indent), v)
iago.MustWriteString(w, "}")
iago.MustWriteByte(w, '}')
}

func (vis *visitor) visitArrayValues(w io.Writer, v Value) {
Expand Down
6 changes: 3 additions & 3 deletions filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func ReflectTypeFilter(w io.Writer, v Value) (n int, err error) {

if s := t.PkgPath(); s != "" {
n += iago.MustWriteString(w, s)
n += iago.MustWriteString(w, ".")
n += iago.MustWriteByte(w, '.')
}

if s := t.Name(); s != "" {
Expand All @@ -70,11 +70,11 @@ func ReflectTypeFilter(w io.Writer, v Value) (n int, err error) {
// always render the pointer value for the type, this way when the field is
// unexported we still get something we can compare to known types instead of a
// rendering of the reflect.rtype struct.
n += iago.MustWriteString(w, " ")
n += iago.MustWriteByte(w, ' ')
n += iago.MustWriteString(w, formatPointerHex(v.Value.Pointer(), false))

if ambiguous {
n += iago.MustWriteString(w, ")")
n += iago.MustWriteByte(w, ')')
}

return
Expand Down
2 changes: 1 addition & 1 deletion map.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (vis *visitor) visitMap(w io.Writer, v Value) {

iago.MustWriteString(w, "{\n")
vis.visitMapElements(indent.NewIndenter(w, vis.indent), v)
iago.MustWriteString(w, "}")
iago.MustWriteByte(w, '}')
}

func (vis *visitor) visitMapElements(w io.Writer, v Value) {
Expand Down
2 changes: 1 addition & 1 deletion ptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func (vis *visitor) visitPtr(w io.Writer, v Value) {
defer vis.leave(v)

if v.IsAmbiguousType() {
iago.MustWriteString(w, "*")
iago.MustWriteByte(w, '*')
}

elem := v.Value.Elem()
Expand Down
4 changes: 2 additions & 2 deletions shallow.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (vis *visitor) visitUnsafePointer(w io.Writer, v Value) {
func (vis *visitor) visitChan(w io.Writer, v Value) {
if v.IsAmbiguousType() {
iago.MustWriteString(w, v.TypeName())
iago.MustWriteString(w, "(")
iago.MustWriteByte(w, '(')
}

iago.MustWriteString(
Expand All @@ -99,7 +99,7 @@ func (vis *visitor) visitChan(w io.Writer, v Value) {
}

if v.IsAmbiguousType() {
iago.MustWriteString(w, ")")
iago.MustWriteByte(w, ')')
}
}

Expand Down
2 changes: 1 addition & 1 deletion struct.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (vis *visitor) visitStruct(w io.Writer, v Value) {

iago.MustWriteString(w, "{\n")
vis.visitStructFields(indent.NewIndenter(w, vis.indent), v)
iago.MustWriteString(w, "}")
iago.MustWriteByte(w, '}')
}

func (vis *visitor) visitStructFields(w io.Writer, v Value) {
Expand Down
4 changes: 2 additions & 2 deletions visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ func (vis *visitor) enter(w io.Writer, v Value) bool {

if v.IsAmbiguousType() {
iago.MustWriteString(w, v.TypeName())
iago.MustWriteString(w, "(")
iago.MustWriteByte(w, '(')
iago.MustWriteString(w, marker)
iago.MustWriteString(w, ")")
iago.MustWriteByte(w, ')')
} else {
iago.MustWriteString(w, marker)
}
Expand Down

0 comments on commit d30a999

Please sign in to comment.