mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +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
1 changed files with 2 additions and 10 deletions
|
|
@ -868,11 +868,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
|
|||
isNull := item[0] == 'n' // null
|
||||
u, ut, pv := indirect(v, isNull)
|
||||
if u != nil {
|
||||
err := u.UnmarshalJSON(item)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return u.UnmarshalJSON(item)
|
||||
}
|
||||
if ut != nil {
|
||||
if item[0] != '"' {
|
||||
|
|
@ -899,11 +895,7 @@ func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool
|
|||
}
|
||||
return errPhase
|
||||
}
|
||||
err := ut.UnmarshalText(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
return ut.UnmarshalText(s)
|
||||
}
|
||||
|
||||
v = pv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue