Skip to content

Commit b0232ed

Browse files
author
Robert Welin
committed
Remove nil == nil if-statement
Found using the nilness analysis: ``` $ go install golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness $ go vet -vettool=$(which nilness) \# github.com/json-iterator/go ./iter_object.go:241:10: tautological condition: nil == nil ```
1 parent 44a7e73 commit b0232ed

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

iter_object.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,6 @@ func (iter *Iterator) readObjectStart() bool {
238238
func (iter *Iterator) readObjectFieldAsBytes() (ret []byte) {
239239
str := iter.ReadStringAsSlice()
240240
if iter.skipWhitespacesWithoutLoadMore() {
241-
if ret == nil {
242-
ret = make([]byte, len(str))
243-
copy(ret, str)
244-
}
245241
if !iter.loadMore() {
246242
return
247243
}

0 commit comments

Comments
 (0)