mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Some code improvements
* Rewrite if-else chain as a switch. * Rewrite switch statement with only one case as if. * Remove always true condition. * Simplify some functions.
This commit is contained in:
@ -717,12 +717,12 @@ func (cmd *StringSliceCmd) readReply(rd *proto.Reader) error {
|
||||
func stringSliceParser(rd *proto.Reader, n int64) (interface{}, error) {
|
||||
ss := make([]string, 0, n)
|
||||
for i := int64(0); i < n; i++ {
|
||||
s, err := rd.ReadString()
|
||||
if err == Nil {
|
||||
switch s, err := rd.ReadString(); {
|
||||
case err == Nil:
|
||||
ss = append(ss, "")
|
||||
} else if err != nil {
|
||||
case err != nil:
|
||||
return nil, err
|
||||
} else {
|
||||
default:
|
||||
ss = append(ss, s)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user