diff --git a/src/command.rs b/src/command.rs index 1d37d0e..9de1d7e 100644 --- a/src/command.rs +++ b/src/command.rs @@ -127,11 +127,10 @@ impl TryFrom for VendorCommand { type Error = (); fn try_from(from: u8) -> core::result::Result { - match from { - // code if code >= Self::FIRST && code <= Self::LAST => Ok(VendorCommand(code)), - code @ Self::FIRST..=Self::LAST => Ok(unsafe { core::mem::transmute(code) }), - // TODO: replace with Command::Unknown and infallible Try - _ => Err(()), + if (Self::FIRST..=Self::LAST).contains(&from) { + Ok(unsafe { core::mem::transmute::(from) }) + } else { + Err(()) } } } diff --git a/src/dispatch.rs b/src/dispatch.rs index 951d3da..fdda759 100644 --- a/src/dispatch.rs +++ b/src/dispatch.rs @@ -12,7 +12,7 @@ pub struct Dispatch<'pipe, 'interrupt> { interrupt: Option<&'interrupt OptionRefSwap<'interrupt, InterruptFlag>>, } -impl<'pipe, 'interrupt> Dispatch<'pipe, 'interrupt> { +impl<'pipe> Dispatch<'pipe, '_> { pub fn new(responder: Responder<'pipe>) -> Self { Dispatch { responder,