diff options
author | Daniel Martí <mvdan@mvdan.cc> | 2017-10-28 17:35:27 +0100 |
---|---|---|
committer | Daniel Martí <mvdan@mvdan.cc> | 2017-10-31 20:07:46 +0000 |
commit | 7cb3e4fb1d6b2704ecdc3d6983587975ce077a34 (patch) | |
tree | de4fe981bb9df8912617c91e068125f66479ae23 /src/mime | |
parent | 94484d8ed5155873306ab41f49b0b30be19031a9 (diff) | |
download | go-7cb3e4fb1d6b2704ecdc3d6983587975ce077a34.tar.gz go-7cb3e4fb1d6b2704ecdc3d6983587975ce077a34.zip |
all: unindent some if bodies by exiting early
All of these had a return or break in the else body, so flipping the
condition means we can unindent and simplify.
Change-Id: If93e97504480d18a0dac3f2c8ffe57ab8bcb929c
Reviewed-on: https://go-review.googlesource.com/74190
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/mime')
-rw-r--r-- | src/mime/mediatype.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mime/mediatype.go b/src/mime/mediatype.go index b8a83d6f79..426d417da2 100644 --- a/src/mime/mediatype.go +++ b/src/mime/mediatype.go @@ -187,18 +187,18 @@ func ParseMediaType(v string) (mediatype string, params map[string]string, err e continue } encodedPart := simplePart + "*" - if v, ok := pieceMap[encodedPart]; ok { - valid = true - if n == 0 { - if decv, ok := decode2231Enc(v); ok { - buf.WriteString(decv) - } - } else { - decv, _ := percentHexUnescape(v) + v, ok := pieceMap[encodedPart] + if !ok { + break + } + valid = true + if n == 0 { + if decv, ok := decode2231Enc(v); ok { buf.WriteString(decv) } } else { - break + decv, _ := percentHexUnescape(v) + buf.WriteString(decv) } } if valid { |