Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Commit b134d86

Browse files
committed
optimize code
1 parent bc32218 commit b134d86

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

extra/fuzzy_decoder.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ func (decoder *fuzzyIntegerDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
202202
case jsoniter.StringValue:
203203
str = iter.ReadString()
204204
case jsoniter.BoolValue:
205-
b := iter.ReadBool()
206-
if b == true {
205+
if iter.ReadBool() {
207206
str = "1"
208207
} else {
209208
str = "0"
@@ -239,8 +238,7 @@ func (decoder *fuzzyFloat32Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
239238
}
240239
case jsoniter.BoolValue:
241240
// support bool to float32
242-
b := iter.ReadBool()
243-
if b == true {
241+
if iter.ReadBool() {
244242
*((*float32)(ptr)) = 1
245243
} else {
246244
*((*float32)(ptr)) = 0
@@ -269,8 +267,7 @@ func (decoder *fuzzyFloat64Decoder) Decode(ptr unsafe.Pointer, iter *jsoniter.It
269267
}
270268
case jsoniter.BoolValue:
271269
// support bool to float64
272-
b := iter.ReadBool()
273-
if b == true {
270+
if iter.ReadBool() {
274271
*((*float64)(ptr)) = 1
275272
} else {
276273
*((*float64)(ptr)) = 0

0 commit comments

Comments
 (0)