mirror of
https://github.com/golang/go.git
synced 2025-05-16 21:04:38 +00:00
encoding/json: remove unnecessary if conditions
Fixes gosimple warning "if err != nil { return err }; return nil' can be simplified to 'return err" Change-Id: Ife7f78a3a76ab7802b5561d1afec536e103b504a Reviewed-on: https://go-review.googlesource.com/108275 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
9f10d28304
commit
c2a53b1b82
@ -868,11 +868,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
|
|||||||
isNull := item[0] == 'n' // null
|
isNull := item[0] == 'n' // null
|
||||||
u, ut, pv := indirect(v, isNull)
|
u, ut, pv := indirect(v, isNull)
|
||||||
if u != nil {
|
if u != nil {
|
||||||
err := u.UnmarshalJSON(item)
|
return u.UnmarshalJSON(item)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
if ut != nil {
|
if ut != nil {
|
||||||
if item[0] != '"' {
|
if item[0] != '"' {
|
||||||
@ -899,11 +895,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
|
|||||||
}
|
}
|
||||||
return errPhase
|
return errPhase
|
||||||
}
|
}
|
||||||
err := ut.UnmarshalText(s)
|
return ut.UnmarshalText(s)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
v = pv
|
v = pv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user