File tree Expand file tree Collapse file tree 1 file changed +16
-20
lines changed Expand file tree Collapse file tree 1 file changed +16
-20
lines changed Original file line number Diff line number Diff line change @@ -85,34 +85,30 @@ impl TryFrom<Response> for SubscribeItem {
85
85
86
86
match & mtype {
87
87
s if s == & TYPE_SUBSCRIBE || s == & TYPE_SSUBSCRIBE || s == & TYPE_PSUBSCRIBE => {
88
- return Ok ( SubscribeItem :: Subscribed ( channel) ) ;
88
+ Ok ( SubscribeItem :: Subscribed ( channel) )
89
89
}
90
90
s if s == & TYPE_UNSUBSCRIBE || s == & TYPE_SUNSUBSCRIBE || s == & TYPE_PUNSUBSCRIBE => {
91
- return Ok ( SubscribeItem :: UnSubscribed ( channel) ) ;
91
+ Ok ( SubscribeItem :: UnSubscribed ( channel) )
92
92
}
93
93
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
+ } )
96
100
} else {
97
- return Err ( CommandError :: Output (
101
+ Err ( CommandError :: Output (
98
102
"Subscription message payload is not bytes" ,
99
103
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
+ }
114
106
}
115
- } ;
107
+ _ => Err ( CommandError :: Output (
108
+ "Subscription message type unknown" ,
109
+ Response :: Bytes ( mtype) ,
110
+ ) ) ,
111
+ }
116
112
}
117
113
}
118
114
You can’t perform that action at this time.
0 commit comments