Skip to content

Commit d52f4ed

Browse files
committed
remove return
1 parent 8c487be commit d52f4ed

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

src/cmd/pubsub.rs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,34 +85,30 @@ impl TryFrom<Response> for SubscribeItem {
8585

8686
match &mtype {
8787
s if s == &TYPE_SUBSCRIBE || s == &TYPE_SSUBSCRIBE || s == &TYPE_PSUBSCRIBE => {
88-
return Ok(SubscribeItem::Subscribed(channel));
88+
Ok(SubscribeItem::Subscribed(channel))
8989
}
9090
s if s == &TYPE_UNSUBSCRIBE || s == &TYPE_SUNSUBSCRIBE || s == &TYPE_PUNSUBSCRIBE => {
91-
return Ok(SubscribeItem::UnSubscribed(channel));
91+
Ok(SubscribeItem::UnSubscribed(channel))
9292
}
9393
s if s == &TYPE_MESSAGE || s == &TYPE_SMESSAGE || s == &TYPE_PMESSAGE => {
94-
let payload = if let Some(payload) = payload.0.left() {
95-
payload
94+
if let Some(payload) = payload.0.left() {
95+
Ok(SubscribeItem::Message {
96+
pattern,
97+
channel,
98+
payload,
99+
})
96100
} else {
97-
return Err(CommandError::Output(
101+
Err(CommandError::Output(
98102
"Subscription message payload is not bytes",
99103
Response::Nil,
100-
));
101-
};
102-
103-
return Ok(SubscribeItem::Message {
104-
pattern,
105-
channel,
106-
payload,
107-
});
108-
}
109-
_ => {
110-
return Err(CommandError::Output(
111-
"Subscription message type unknown",
112-
Response::Bytes(mtype),
113-
));
104+
))
105+
}
114106
}
115-
};
107+
_ => Err(CommandError::Output(
108+
"Subscription message type unknown",
109+
Response::Bytes(mtype),
110+
)),
111+
}
116112
}
117113
}
118114

0 commit comments

Comments
 (0)