Skip to content

Commit a1eb0fa

Browse files
committed
Use else if instead of a if nested in an else.
1 parent 8fdd3f7 commit a1eb0fa

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/reply.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ impl FromStr for Reply {
2323
fn from_str(s: &str) -> Result<Reply, ParseError> {
2424
if s == "OK" || s == "list_OK" {
2525
Ok(Reply::Ok)
26+
} else if let Ok(ack) = s.parse::<ServerError>() {
27+
Ok(Reply::Ack(ack))
2628
} else {
27-
if let Ok(ack) = s.parse::<ServerError>() {
28-
Ok(Reply::Ack(ack))
29-
} else {
30-
let mut splits = s.splitn(2, ':');
31-
match (splits.next(), splits.next()) {
32-
(Some(a), Some(b)) => Ok(Reply::Pair(a.to_owned(), b.trim().to_owned())),
33-
_ => Err(ParseError::BadPair),
34-
}
29+
let mut splits = s.splitn(2, ':');
30+
match (splits.next(), splits.next()) {
31+
(Some(a), Some(b)) => Ok(Reply::Pair(a.to_owned(), b.trim().to_owned())),
32+
_ => Err(ParseError::BadPair),
3533
}
3634
}
3735
}

0 commit comments

Comments
 (0)