src: mqtt: Replace single-branch match with if let
This commit is contained in:
+1
-4
@@ -70,13 +70,10 @@ impl MQTT {
|
|||||||
let notification = self.eventloop.poll().await?;
|
let notification = self.eventloop.poll().await?;
|
||||||
debug!("Notification = {:?}", notification);
|
debug!("Notification = {:?}", notification);
|
||||||
|
|
||||||
match notification {
|
if let Event::Incoming(Incoming::Publish(p)) = notification {
|
||||||
Event::Incoming(Incoming::Publish(p)) => {
|
|
||||||
let msg: StatusMessage = serde_json::from_slice(p.payload.as_ref())?;
|
let msg: StatusMessage = serde_json::from_slice(p.payload.as_ref())?;
|
||||||
info!("Message: {:?}", msg);
|
info!("Message: {:?}", msg);
|
||||||
callback(msg);
|
callback(msg);
|
||||||
},
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user