Skip to content

Commit

Permalink
make clippy happy
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Gherghescu <[email protected]>
  • Loading branch information
andrei-ng committed Dec 23, 2024
1 parent d6f4804 commit 83b105a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions ublox/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<'a> FixedLinearBuffer<'a> {
}
}

impl<'a> core::ops::Index<core::ops::Range<usize>> for FixedLinearBuffer<'a> {
impl core::ops::Index<core::ops::Range<usize>> for FixedLinearBuffer<'_> {
type Output = [u8];

fn index(&self, index: core::ops::Range<usize>) -> &Self::Output {
Expand All @@ -104,15 +104,15 @@ impl<'a> core::ops::Index<core::ops::Range<usize>> for FixedLinearBuffer<'a> {
}
}

impl<'a> core::ops::Index<usize> for FixedLinearBuffer<'a> {
impl core::ops::Index<usize> for FixedLinearBuffer<'_> {
type Output = u8;

fn index(&self, index: usize) -> &Self::Output {
&self.buffer[index]
}
}

impl<'a> UnderlyingBuffer for FixedLinearBuffer<'a> {
impl UnderlyingBuffer for FixedLinearBuffer<'_> {
fn clear(&mut self) {
self.len = 0;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ struct DualBuffer<'a, T: UnderlyingBuffer> {
new_buf_offset: usize,
}

impl<'a, T: UnderlyingBuffer> core::ops::Index<usize> for DualBuffer<'a, T> {
impl<T: UnderlyingBuffer> core::ops::Index<usize> for DualBuffer<'_, T> {
type Output = u8;

fn index(&self, index: usize) -> &u8 {
Expand Down Expand Up @@ -375,7 +375,7 @@ impl<'a, T: UnderlyingBuffer> DualBuffer<'a, T> {
}
}

impl<'a, T: UnderlyingBuffer> Drop for DualBuffer<'a, T> {
impl<T: UnderlyingBuffer> Drop for DualBuffer<'_, T> {
fn drop(&mut self) {
self.buf.drain(self.off);
self.buf
Expand Down Expand Up @@ -416,7 +416,7 @@ pub struct ParserIter<'a, T: UnderlyingBuffer> {
buf: DualBuffer<'a, T>,
}

impl<'a, T: UnderlyingBuffer> ParserIter<'a, T> {
impl<T: UnderlyingBuffer> ParserIter<'_, T> {
fn find_sync(&self) -> Option<usize> {
(0..self.buf.len()).find(|&i| self.buf[i] == SYNC_CHAR_1)
}
Expand Down
24 changes: 12 additions & 12 deletions ublox/src/ubx_packets/packets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ struct AckAck {
msg_id: u8,
}

impl<'a> AckAckRef<'a> {
impl AckAckRef<'_> {
pub fn is_ack_for<T: UbxPacketMeta>(&self) -> bool {
self.class() == T::CLASS && self.msg_id() == T::ID
}
Expand All @@ -1312,7 +1312,7 @@ struct AckNak {
msg_id: u8,
}

impl<'a> AckNakRef<'a> {
impl AckNakRef<'_> {
pub fn is_nak_for<T: UbxPacketMeta>(&self) -> bool {
self.class() == T::CLASS && self.msg_id() == T::ID
}
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down Expand Up @@ -3155,7 +3155,7 @@ impl EsfMeas {
}
}

impl<'a> EsfMeasRef<'a> {
impl EsfMeasRef<'_> {
fn data_len(&self) -> usize {
self.flags().num_meas() as usize * 4
}
Expand Down Expand Up @@ -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<Self::Item> {
Expand All @@ -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,
})
}
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down Expand Up @@ -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<Self::Item> {
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(),
})
}
}
Expand Down Expand Up @@ -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<Self::Item> {
Expand Down

0 comments on commit 83b105a

Please sign in to comment.