diff options
| author | tengufromsky <nick27surgut@gmail.com> | 2018-04-19 21:56:45 +0300 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-04-20 01:41:41 +0000 |
| commit | c2a53b1b82161aaff2f2e09a46cbee8eccea8cd8 (patch) | |
| tree | 6ee6b660a9847f1f07dce895db48d86f6039ab3a /src/encoding/json | |
| parent | 9f10d283045d9fd7dc9afb64c49e6719ef1a33c8 (diff) | |
| download | go-c2a53b1b82161aaff2f2e09a46cbee8eccea8cd8.tar.xz | |
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>
Diffstat (limited to 'src/encoding/json')
| -rw-r--r-- | src/encoding/json/decode.go | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go index 9479e1a5c6..6a66940034 100644 --- a/src/encoding/json/decode.go +++ b/src/encoding/json/decode.go @@ -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 |
