diff --git a/emgauwa-controller/src/utils.rs b/emgauwa-controller/src/utils.rs index c88f340..f09af81 100644 --- a/emgauwa-controller/src/utils.rs +++ b/emgauwa-controller/src/utils.rs @@ -46,9 +46,7 @@ pub async fn app_state_update_relays_on( relay_states: RelayStates, ) -> Result<(), EmgauwaError> { app_state - .send(app_state::UpdateRelayStates { - relay_states: relay_states, - }) + .send(app_state::UpdateRelayStates { relay_states }) .await .map_err(EmgauwaError::from) } diff --git a/emgauwa-controller/src/ws/mod.rs b/emgauwa-controller/src/ws/mod.rs index b0a8a98..559dc2e 100644 --- a/emgauwa-controller/src/ws/mod.rs +++ b/emgauwa-controller/src/ws/mod.rs @@ -104,8 +104,8 @@ async fn handle_message( return; } }; - match msg { - Message::Text(text) => match serde_json::from_str(&text) { + if let Message::Text(text) = msg { + match serde_json::from_str(&text) { Ok(action) => { log::debug!("Received action: {:?}", action); let mut pool_conn = match pool.acquire().await { @@ -123,8 +123,7 @@ async fn handle_message( Err(e) => { log::error!("Error deserializing action: {:?}", e); } - }, - _ => {} + } } } diff --git a/emgauwa-core/src/handlers/v1/ws/relays/mod.rs b/emgauwa-core/src/handlers/v1/ws/relays/mod.rs index e1208e7..5788aec 100644 --- a/emgauwa-core/src/handlers/v1/ws/relays/mod.rs +++ b/emgauwa-core/src/handlers/v1/ws/relays/mod.rs @@ -38,7 +38,6 @@ impl Actor for RelaysWs { Err(err) => { log::error!("Error getting relays: {:?}", err); ctx.stop(); - return; } } } diff --git a/emgauwa-lib/src/utils.rs b/emgauwa-lib/src/utils.rs index 776259b..9b2d4ab 100644 --- a/emgauwa-lib/src/utils.rs +++ b/emgauwa-lib/src/utils.rs @@ -104,14 +104,11 @@ pub fn get_weekday() -> Weekday { pub fn printable_relay_states(relay_states: &RelayStates) -> String { let mut relay_debug = String::new(); relay_states.iter().for_each(|state| { - relay_debug.push_str(&format!( - "{}", - match state { - Some(true) => "+", - Some(false) => "-", - None => "?", - } - )); + relay_debug.push_str(match state { + Some(true) => "+", + Some(false) => "-", + None => "?", + }); }); relay_debug }