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:
tengufromsky 2018-04-19 21:56:45 +03:00 committed by Brad Fitzpatrick
parent 9f10d28304
commit c2a53b1b82

View File

@ -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