mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-14 15:56:44 +03:00
Refactor by removing unnecessary else block (#1559)
This commit is contained in:
@@ -598,9 +598,8 @@ func decodeArgAppendNoPlus(dst, src []byte) []byte {
|
||||
if idx < 0 {
|
||||
// fast path: src doesn't contain encoded chars
|
||||
return append(dst, src...)
|
||||
} else {
|
||||
dst = append(dst, src[:idx]...)
|
||||
}
|
||||
dst = append(dst, src[:idx]...)
|
||||
|
||||
// slow path
|
||||
for i := idx; i < len(src); i++ {
|
||||
|
||||
+9
-10
@@ -72,16 +72,15 @@ func (rs *requestStream) Read(p []byte) (int, error) {
|
||||
return n, io.EOF
|
||||
}
|
||||
return n, err
|
||||
} else {
|
||||
left := rs.header.ContentLength() - rs.totalBytesRead
|
||||
if len(p) > left {
|
||||
p = p[:left]
|
||||
}
|
||||
n, err = rs.reader.Read(p)
|
||||
rs.totalBytesRead += n
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
}
|
||||
left := rs.header.ContentLength() - rs.totalBytesRead
|
||||
if len(p) > left {
|
||||
p = p[:left]
|
||||
}
|
||||
n, err = rs.reader.Read(p)
|
||||
rs.totalBytesRead += n
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
if rs.totalBytesRead == rs.header.ContentLength() {
|
||||
|
||||
Reference in New Issue
Block a user