Fix some clippy issues
This commit is contained in:
parent
ab7090f2c5
commit
6f2deb38e1
4 changed files with 9 additions and 16 deletions
|
@ -46,9 +46,7 @@ pub async fn app_state_update_relays_on(
|
||||||
relay_states: RelayStates,
|
relay_states: RelayStates,
|
||||||
) -> Result<(), EmgauwaError> {
|
) -> Result<(), EmgauwaError> {
|
||||||
app_state
|
app_state
|
||||||
.send(app_state::UpdateRelayStates {
|
.send(app_state::UpdateRelayStates { relay_states })
|
||||||
relay_states: relay_states,
|
|
||||||
})
|
|
||||||
.await
|
.await
|
||||||
.map_err(EmgauwaError::from)
|
.map_err(EmgauwaError::from)
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,8 +104,8 @@ async fn handle_message(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match msg {
|
if let Message::Text(text) = msg {
|
||||||
Message::Text(text) => match serde_json::from_str(&text) {
|
match serde_json::from_str(&text) {
|
||||||
Ok(action) => {
|
Ok(action) => {
|
||||||
log::debug!("Received action: {:?}", action);
|
log::debug!("Received action: {:?}", action);
|
||||||
let mut pool_conn = match pool.acquire().await {
|
let mut pool_conn = match pool.acquire().await {
|
||||||
|
@ -123,8 +123,7 @@ async fn handle_message(
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("Error deserializing action: {:?}", e);
|
log::error!("Error deserializing action: {:?}", e);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ impl Actor for RelaysWs {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!("Error getting relays: {:?}", err);
|
log::error!("Error getting relays: {:?}", err);
|
||||||
ctx.stop();
|
ctx.stop();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,14 +104,11 @@ pub fn get_weekday() -> Weekday {
|
||||||
pub fn printable_relay_states(relay_states: &RelayStates) -> String {
|
pub fn printable_relay_states(relay_states: &RelayStates) -> String {
|
||||||
let mut relay_debug = String::new();
|
let mut relay_debug = String::new();
|
||||||
relay_states.iter().for_each(|state| {
|
relay_states.iter().for_each(|state| {
|
||||||
relay_debug.push_str(&format!(
|
relay_debug.push_str(match state {
|
||||||
"{}",
|
Some(true) => "+",
|
||||||
match state {
|
Some(false) => "-",
|
||||||
Some(true) => "+",
|
None => "?",
|
||||||
Some(false) => "-",
|
});
|
||||||
None => "?",
|
|
||||||
}
|
|
||||||
));
|
|
||||||
});
|
});
|
||||||
relay_debug
|
relay_debug
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue