matrix2mqtt: clippy clean
This commit is contained in:
parent
ae4cfbcb09
commit
1180fff5c7
1 changed files with 11 additions and 14 deletions
|
@ -171,7 +171,7 @@ async fn read_single_mapping(
|
|||
reader.read_line(&mut line).await?;
|
||||
let splitter = line
|
||||
.strip_prefix("MP ")
|
||||
.and_then(|s| Some(s.split_whitespace()))
|
||||
.map(|s| s.split_whitespace())
|
||||
.ok_or(ParseMatrixPortError)?
|
||||
.collect::<Vec<&str>>();
|
||||
if splitter.len() != 2 {
|
||||
|
@ -287,16 +287,16 @@ async fn handle_publish(
|
|||
matrix_command_tx
|
||||
.send(MatrixCommand::SetOutputCEC(destination, true))
|
||||
.await?;
|
||||
},
|
||||
}
|
||||
"OFF" => {
|
||||
println!("asked to turn {:#?} off", destination);
|
||||
matrix_command_tx
|
||||
.send(MatrixCommand::SetOutputCEC(destination, false))
|
||||
.await?;
|
||||
},
|
||||
}
|
||||
s => {
|
||||
println!("asked to set {:#?} to unknown value {}", destination, s)
|
||||
},
|
||||
}
|
||||
}
|
||||
} else if let Some(destination_str) = p
|
||||
.topic
|
||||
|
@ -400,7 +400,7 @@ where
|
|||
I: futures::Future<Output = Result<T, E>> + Unpin,
|
||||
{
|
||||
let mut fvec = futures;
|
||||
while fvec.len() > 0 {
|
||||
while !fvec.is_empty() {
|
||||
let (item_resolved, _, remaining_futures) = future::select_all(fvec).await;
|
||||
item_resolved?;
|
||||
fvec = remaining_futures;
|
||||
|
@ -441,14 +441,11 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
|||
loop {
|
||||
select! {
|
||||
notification = connection.poll() => {
|
||||
match notification? {
|
||||
rumqttc::Event::Incoming(rumqttc::Incoming::Publish(p)) => {
|
||||
if let rumqttc::Event::Incoming(rumqttc::Incoming::Publish(p)) = notification? {
|
||||
match handle_publish(&p, &mut mqtt_matrix_command_tx).await {
|
||||
Ok(_) => {},
|
||||
Err(e) => println!("failed to handle event {:#?}: {}", p, e),
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
Ok(matrix_response) = matrix_response_rx.recv() => {
|
||||
|
|
Loading…
Reference in a new issue