Skip to content

Commit

Permalink
Merge pull request #23 from dysonltd/investigate-elide-lifetimes
Browse files Browse the repository at this point in the history
Investigate elide lifetimes
  • Loading branch information
lulf authored Nov 11, 2024
2 parents 218acc8 + 5560dd2 commit 5b4f1d5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/cmd/le.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,7 @@ pub struct LeSetPeriodicAdvSubeventDataParams<'a, 'b> {
pub subevent: &'b [LePeriodicAdvSubeventData<'a>],
}

impl<'a, 'b> WriteHci for LeSetPeriodicAdvSubeventDataParams<'a, 'b> {
impl WriteHci for LeSetPeriodicAdvSubeventDataParams<'_, '_> {
#[inline(always)]
fn size(&self) -> usize {
self.adv_handle.size() + self.subevent.size()
Expand Down
12 changes: 6 additions & 6 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl<'de> ReadHci<'de> for AclPacket<'de> {
}
}

impl<'a> WriteHci for AclPacket<'a> {
impl WriteHci for AclPacket<'_> {
#[inline(always)]
fn size(&self) -> usize {
4 + self.data.len()
Expand All @@ -213,7 +213,7 @@ impl<'a> WriteHci for AclPacket<'a> {
}
}

impl<'a> HostToControllerPacket for AclPacket<'a> {
impl HostToControllerPacket for AclPacket<'_> {
const KIND: PacketKind = PacketKind::AclData;
}

Expand Down Expand Up @@ -364,7 +364,7 @@ impl<'de> ReadHci<'de> for SyncPacket<'de> {
}
}

impl<'a> WriteHci for SyncPacket<'a> {
impl WriteHci for SyncPacket<'_> {
#[inline(always)]
fn size(&self) -> usize {
4 + self.data.len()
Expand All @@ -391,7 +391,7 @@ impl<'a> WriteHci for SyncPacket<'a> {
}
}

impl<'a> HostToControllerPacket for SyncPacket<'a> {
impl HostToControllerPacket for SyncPacket<'_> {
const KIND: PacketKind = PacketKind::SyncData;
}

Expand Down Expand Up @@ -647,7 +647,7 @@ impl<'de> ReadHci<'de> for IsoPacket<'de> {
}
}

impl<'a> WriteHci for IsoPacket<'a> {
impl WriteHci for IsoPacket<'_> {
#[inline(always)]
fn size(&self) -> usize {
4 + self.data_load_len()
Expand Down Expand Up @@ -680,7 +680,7 @@ impl<'a> WriteHci for IsoPacket<'a> {
}
}

impl<'a> HostToControllerPacket for IsoPacket<'a> {
impl HostToControllerPacket for IsoPacket<'_> {
const KIND: PacketKind = PacketKind::IsoData;
}

Expand Down
2 changes: 1 addition & 1 deletion src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ impl<'de> ReadHci<'de> for Event<'de> {
}
}

impl<'a> CommandComplete<'a> {
impl CommandComplete<'_> {
/// Gets the connection handle associated with the command that has completed.
///
/// For commands that return the connection handle provided as a parameter as
Expand Down
6 changes: 3 additions & 3 deletions src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,19 @@ impl<T, E> Try for Result<T, E> {
#[allow(unused)]
pub(crate) struct Bytes<'a>(pub &'a [u8]);

impl<'a> Debug for Bytes<'a> {
impl Debug for Bytes<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{:#02x?}", self.0)
}
}

impl<'a> Display for Bytes<'a> {
impl Display for Bytes<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{:#02x?}", self.0)
}
}

impl<'a> LowerHex for Bytes<'a> {
impl LowerHex for Bytes<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{:#02x?}", self.0)
}
Expand Down
6 changes: 3 additions & 3 deletions src/param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ pub use status::*;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct RemainingBytes<'a>(&'a [u8]);

impl<'a> core::ops::Deref for RemainingBytes<'a> {
impl core::ops::Deref for RemainingBytes<'_> {
type Target = [u8];

fn deref(&self) -> &Self::Target {
self.0
}
}

impl<'a> WriteHci for RemainingBytes<'a> {
impl WriteHci for RemainingBytes<'_> {
#[inline(always)]
fn size(&self) -> usize {
self.0.len()
Expand All @@ -48,7 +48,7 @@ impl<'a> WriteHci for RemainingBytes<'a> {
}
}

impl<'a> AsHciBytes for RemainingBytes<'a> {
impl AsHciBytes for RemainingBytes<'_> {
fn as_hci_bytes(&self) -> &[u8] {
self.0
}
Expand Down
12 changes: 6 additions & 6 deletions src/param/le.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ param! {
}
}

impl<'a> LeAdvReports<'a> {
impl LeAdvReports<'_> {
/// Check if there are more reports available.
pub fn is_empty(&self) -> bool {
self.num_reports == 0
Expand Down Expand Up @@ -608,13 +608,13 @@ impl<'a> Iterator for LeAdvReportsIter<'a> {
}
}

impl<'a> ExactSizeIterator for LeAdvReportsIter<'a> {
impl ExactSizeIterator for LeAdvReportsIter<'_> {
fn len(&self) -> usize {
self.len
}
}

impl<'a> FusedIterator for LeAdvReportsIter<'a> {}
impl FusedIterator for LeAdvReportsIter<'_> {}

param! {
struct LeExtAdvReport<'a> {
Expand All @@ -633,7 +633,7 @@ param! {
}
}

impl<'a> LeExtAdvReports<'a> {
impl LeExtAdvReports<'_> {
/// Check if there are more reports available.
pub fn is_empty(&self) -> bool {
self.num_reports == 0
Expand Down Expand Up @@ -685,13 +685,13 @@ impl<'a> Iterator for LeExtAdvReportsIter<'a> {
}
}

impl<'a> ExactSizeIterator for LeExtAdvReportsIter<'a> {
impl ExactSizeIterator for LeExtAdvReportsIter<'_> {
fn len(&self) -> usize {
self.len
}
}

impl<'a> FusedIterator for LeExtAdvReportsIter<'a> {}
impl FusedIterator for LeExtAdvReportsIter<'_> {}

param! {
struct LePeriodicAdvSubeventData<'a> {
Expand Down
2 changes: 1 addition & 1 deletion src/param/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<'de> FromHciBytes<'de> for &'de bool {
}
}

impl<'a> WriteHci for &'a [u8] {
impl WriteHci for &[u8] {
#[inline(always)]
fn size(&self) -> usize {
self.len()
Expand Down
2 changes: 1 addition & 1 deletion src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<'a, T: HostToControllerPacket> WithIndicator<'a, T> {
}
}

impl<'a, T: HostToControllerPacket> WriteHci for WithIndicator<'a, T> {
impl<T: HostToControllerPacket> WriteHci for WithIndicator<'_, T> {
#[inline(always)]
fn size(&self) -> usize {
1 + self.0.size()
Expand Down

0 comments on commit 5b4f1d5

Please sign in to comment.