1313// limitations under the License.
1414//
1515
16- use actix_ws;
1716use futures_util:: StreamExt ;
1817
1918use futures:: future:: { AbortHandle , Abortable } ;
@@ -187,7 +186,7 @@ async fn handle_command(
187186 tracing:: debug!( "PERSONAL from {} to {}" , & client_name, & to) ;
188187 let payload =
189188 json ! ( { "personal" : client_name, "correlation" : correlation, "data" : data } ) ;
190- if !send_to_name ( & hub_state, & to, payload) . await {
189+ if !send_to_name ( hub_state, & to, payload) . await {
191190 tracing:: debug!( "PERSONAL send from [{}] to [{}] failed" , & client_name, & to) ;
192191 result_err ( "failed" , & correlation, ws) . await ;
193192 }
@@ -201,7 +200,7 @@ async fn handle_command(
201200 } => {
202201 tracing:: debug!( "ANSWER from {} to {}" , & client_name, & to) ;
203202 let payload = json ! ( { "correlation" : correlation, "data" : data } ) ;
204- if !send_to_name ( & hub_state, & to, payload) . await {
203+ if !send_to_name ( hub_state, & to, payload) . await {
205204 tracing:: debug!( "PERSONAL send_to failed: no such session {}" , to) ;
206205 }
207206 }
@@ -233,10 +232,8 @@ async fn handle_command(
233232 // TTL logic
234233 let real_ttl = if let Some ( secs) = ttl {
235234 Some ( Ttl :: Sec ( secs as usize ) )
236- } else if let Some ( timestamp) = expires_at {
237- Some ( Ttl :: At ( timestamp) )
238235 } else {
239- None
236+ expires_at . map ( Ttl :: At )
240237 } ;
241238
242239 // SaveMode logic
@@ -447,11 +444,11 @@ pub async fn handler(
447444 _ => "" ,
448445 } ;
449446
450- if let Some ( ref claim) = claims {
451- if !test_rego_claims ( claim, cmd. as_ref ( ) , key) {
452- let _ = session . text ( "Unauthorized: Rego policy" ) . await ;
453- break ;
454- }
447+ if let Some ( ref claim) = claims
448+ && !test_rego_claims ( claim, cmd. as_ref ( ) , key)
449+ {
450+ let _ = session . text ( "Unauthorized: Rego policy" ) . await ;
451+ break ;
455452 }
456453 }
457454
@@ -470,7 +467,7 @@ pub async fn handler(
470467 }
471468
472469 Err ( err) => {
473- let _ = session. text ( format ! ( "Invalid JSON: {}" , err ) ) . await ;
470+ let _ = session. text ( format ! ( "Invalid JSON: {err}" ) ) . await ;
474471 }
475472 } ,
476473
0 commit comments