diff --git a/Cargo.toml b/Cargo.toml index ed78afe..dafad13 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "firmata-client-rs" -version = "0.4.2" +version = "0.4.3" license = "MIT OR Apache-2.0" authors = ["Brandon Walsh "] readme = "README.md" diff --git a/src/board/mod.rs b/src/board/mod.rs index 78cb5da..6b299d1 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -252,7 +252,7 @@ use crate::types::{ let port = (pin/8) as usize; if let Some(pin) = self.pins.get_mut(pin as usize) { - pin.value = if level { 1 } else { 0 }; + pin.value = u8::from(level); } else { return Err(Error::PinOutOfBounds { pin, len: self.pins.len() }) } diff --git a/src/board/poll.rs b/src/board/poll.rs index a2441d0..f516a1d 100644 --- a/src/board/poll.rs +++ b/src/board/poll.rs @@ -99,7 +99,7 @@ impl Board { // channel info into local data let mut pin_updates:Vec<(u8, bool)> = vec![]; - for index in 0..8 as u8 { + for index in 0..8u8 { let pin_index = (8 * port) + index; if let Some(pin) = self.pins.get_mut(pin_index as usize) { diff --git a/src/types/message.rs b/src/types/message.rs index e7012f3..b71efcb 100644 --- a/src/types/message.rs +++ b/src/types/message.rs @@ -13,6 +13,7 @@ pub enum Message { } impl Message { + #[must_use] pub fn try_as_analog(&self) -> Option<&Vec<(u8, u8)>> { if let Message::Analog(data) = self { Some(data) @@ -20,6 +21,7 @@ impl Message { None } } + #[must_use] pub fn try_as_digital(&self) -> Option<&Vec<(u8, bool)>> { if let Message::Digital(data) = self { Some(data)