mqtt_mux: remove excessive paranthesis

This commit is contained in:
occheung 2020-09-18 12:24:27 +08:00
parent a7073c419b
commit a5dbfdaf4f

View File

@ -150,7 +150,7 @@ impl<SPI, E> MqttMux<SPI> where SPI: Transfer<u8, Error = E> {
let division = u8::from_str_radix(core::str::from_utf8(message).unwrap(), 10) let division = u8::from_str_radix(core::str::from_utf8(message).unwrap(), 10)
.map_or_else( .map_or_else(
|_| Err(Error::MqttCommandError), |_| Err(Error::MqttCommandError),
|div| if (div == 1 || div == 2 || div == 4) { |div| if div == 1 || div == 2 || div == 4 {
Ok(div) Ok(div)
} else { } else {
Err(Error::MqttCommandError) Err(Error::MqttCommandError)
@ -185,6 +185,8 @@ impl<SPI, E> MqttMux<SPI> where SPI: Transfer<u8, Error = E> {
} }
// TODO: Implement this // TODO: Implement this
// Only need to sort the command enum
// Obviously. This is what a MUX does
fn execute(&mut self, command_type: MqttCommandType) -> Result<(), Error<E>> { fn execute(&mut self, command_type: MqttCommandType) -> Result<(), Error<E>> {
info!("{:?}", command_type); info!("{:?}", command_type);
match command_type { match command_type {