diff --git a/ublox/src/parser.rs b/ublox/src/parser.rs index fae2020..87eebc5 100644 --- a/ublox/src/parser.rs +++ b/ublox/src/parser.rs @@ -93,7 +93,7 @@ impl<'a> FixedLinearBuffer<'a> { } } -impl<'a> core::ops::Index> for FixedLinearBuffer<'a> { +impl core::ops::Index> for FixedLinearBuffer<'_> { type Output = [u8]; fn index(&self, index: core::ops::Range) -> &Self::Output { @@ -104,7 +104,7 @@ impl<'a> core::ops::Index> for FixedLinearBuffer<'a> { } } -impl<'a> core::ops::Index for FixedLinearBuffer<'a> { +impl core::ops::Index for FixedLinearBuffer<'_> { type Output = u8; fn index(&self, index: usize) -> &Self::Output { @@ -112,7 +112,7 @@ impl<'a> core::ops::Index for FixedLinearBuffer<'a> { } } -impl<'a> UnderlyingBuffer for FixedLinearBuffer<'a> { +impl UnderlyingBuffer for FixedLinearBuffer<'_> { fn clear(&mut self) { self.len = 0; } @@ -213,7 +213,7 @@ struct DualBuffer<'a, T: UnderlyingBuffer> { new_buf_offset: usize, } -impl<'a, T: UnderlyingBuffer> core::ops::Index for DualBuffer<'a, T> { +impl core::ops::Index for DualBuffer<'_, T> { type Output = u8; fn index(&self, index: usize) -> &u8 { @@ -375,7 +375,7 @@ impl<'a, T: UnderlyingBuffer> DualBuffer<'a, T> { } } -impl<'a, T: UnderlyingBuffer> Drop for DualBuffer<'a, T> { +impl Drop for DualBuffer<'_, T> { fn drop(&mut self) { self.buf.drain(self.off); self.buf @@ -416,7 +416,7 @@ pub struct ParserIter<'a, T: UnderlyingBuffer> { buf: DualBuffer<'a, T>, } -impl<'a, T: UnderlyingBuffer> ParserIter<'a, T> { +impl ParserIter<'_, T> { fn find_sync(&self) -> Option { (0..self.buf.len()).find(|&i| self.buf[i] == SYNC_CHAR_1) } diff --git a/ublox/src/ubx_packets/packets.rs b/ublox/src/ubx_packets/packets.rs index db89e3a..56fc9ac 100644 --- a/ublox/src/ubx_packets/packets.rs +++ b/ublox/src/ubx_packets/packets.rs @@ -1295,7 +1295,7 @@ struct AckAck { msg_id: u8, } -impl<'a> AckAckRef<'a> { +impl AckAckRef<'_> { pub fn is_ack_for(&self) -> bool { self.class() == T::CLASS && self.msg_id() == T::ID } @@ -1312,7 +1312,7 @@ struct AckNak { msg_id: u8, } -impl<'a> AckNakRef<'a> { +impl AckNakRef<'_> { pub fn is_nak_for(&self) -> bool { self.class() == T::CLASS && self.msg_id() == T::ID } @@ -1799,7 +1799,7 @@ impl<'a> CfgValIter<'a> { } } -impl<'a> core::iter::Iterator for CfgValIter<'a> { +impl core::iter::Iterator for CfgValIter<'_> { type Item = CfgVal; fn next(&mut self) -> Option { @@ -3155,7 +3155,7 @@ impl EsfMeas { } } -impl<'a> EsfMeasRef<'a> { +impl EsfMeasRef<'_> { fn data_len(&self) -> usize { self.flags().num_meas() as usize * 4 } @@ -3239,7 +3239,7 @@ impl<'a> EsfMeasDataIter<'a> { } } -impl<'a> core::iter::Iterator for EsfMeasDataIter<'a> { +impl core::iter::Iterator for EsfMeasDataIter<'_> { type Item = EsfMeasData; fn next(&mut self) -> Option { @@ -3252,7 +3252,7 @@ impl<'a> core::iter::Iterator for EsfMeasDataIter<'a> { } Some(EsfMeasData { - data_type: (((data & 0x3F000000) >> 24) as u8).try_into().unwrap(), + data_type: (((data & 0x3F000000) >> 24) as u8).into(), data_field, }) } @@ -3343,7 +3343,7 @@ impl<'a> EsfRawDataIter<'a> { } } -impl<'a> core::iter::Iterator for EsfRawDataIter<'a> { +impl core::iter::Iterator for EsfRawDataIter<'_> { type Item = EsfRawData; fn next(&mut self) -> Option { @@ -3659,17 +3659,17 @@ impl<'a> EsfStatusDataIter<'a> { } } -impl<'a> core::iter::Iterator for EsfStatusDataIter<'a> { +impl core::iter::Iterator for EsfStatusDataIter<'_> { type Item = EsfStatusData; fn next(&mut self) -> Option { let chunk = self.0.next()?; let data = u32::from_le_bytes(chunk[0..4].try_into().unwrap()); Some(EsfStatusData { - sens_status1: ((data & 0xFF) as u8).try_into().unwrap(), - sens_status2: (((data >> 8) & 0xFF) as u8).try_into().unwrap(), + sens_status1: ((data & 0xFF) as u8).into(), + sens_status2: (((data >> 8) & 0xFF) as u8).into(), freq: ((data >> 16) & 0xFF).try_into().unwrap(), - faults: (((data >> 24) & 0xFF) as u8).try_into().unwrap(), + faults: (((data >> 24) & 0xFF) as u8).into(), }) } } @@ -4024,7 +4024,7 @@ impl<'a> DwrdIter<'a> { } } -impl<'a> core::iter::Iterator for DwrdIter<'a> { +impl core::iter::Iterator for DwrdIter<'_> { type Item = u32; fn next(&mut self) -> Option {