From d7a30f064e4b33053df991331e279722c0c10904 Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Fri, 29 Nov 2024 07:52:39 +0000 Subject: [PATCH] Automatic Clippy fixes --- rs-matter-data-model/src/idl.rs | 2 +- rs-matter/src/cert/asn1_writer.rs | 2 +- rs-matter/src/cert/mod.rs | 2 +- rs-matter/src/cert/printer.rs | 2 +- rs-matter/src/crypto/crypto_rustcrypto.rs | 8 ++-- rs-matter/src/data_model/core.rs | 6 +-- rs-matter/src/data_model/objects/cluster.rs | 6 +-- rs-matter/src/data_model/objects/encoder.rs | 12 ++--- rs-matter/src/data_model/objects/endpoint.rs | 2 +- rs-matter/src/data_model/objects/metadata.rs | 48 ++++++++++++++----- rs-matter/src/data_model/objects/node.rs | 15 +++--- .../data_model/sdm/thread_nw_diagnostics.rs | 4 +- .../data_model/system_model/access_control.rs | 8 +--- .../src/data_model/system_model/descriptor.rs | 6 +-- rs-matter/src/interaction_model/messages.rs | 6 +-- rs-matter/src/mdns.rs | 2 +- rs-matter/src/mdns/builtin.rs | 2 +- rs-matter/src/mdns/proto.rs | 20 ++++---- .../src/secure_channel/crypto_mbedtls.rs | 1 - .../src/secure_channel/crypto_openssl.rs | 1 - .../src/secure_channel/crypto_rustcrypto.rs | 1 - rs-matter/src/tlv.rs | 6 +-- rs-matter/src/tlv/read.rs | 14 +++--- rs-matter/src/tlv/traits.rs | 4 +- rs-matter/src/tlv/traits/container.rs | 2 +- rs-matter/src/tlv/traits/octets.rs | 4 +- rs-matter/src/tlv/traits/slice.rs | 2 +- rs-matter/src/tlv/write.rs | 6 +-- rs-matter/src/transport/core.rs | 33 +++++++------ rs-matter/src/transport/exchange.rs | 12 ++--- .../src/transport/network/btp/context.rs | 2 +- rs-matter/src/transport/session.rs | 4 +- rs-matter/src/utils/storage/pooled.rs | 16 +++++-- rs-matter/src/utils/sync/mutex.rs | 6 +-- rs-matter/tests/common/e2e.rs | 4 +- rs-matter/tests/common/e2e/im.rs | 6 +-- rs-matter/tests/common/e2e/im/attributes.rs | 4 +- rs-matter/tests/common/e2e/im/commands.rs | 4 +- rs-matter/tests/common/e2e/im/handler.rs | 20 +++++--- 39 files changed, 167 insertions(+), 138 deletions(-) diff --git a/rs-matter-data-model/src/idl.rs b/rs-matter-data-model/src/idl.rs index 6e368311..6fbdc00d 100644 --- a/rs-matter-data-model/src/idl.rs +++ b/rs-matter-data-model/src/idl.rs @@ -49,7 +49,7 @@ where } } -impl<'a> DeepestIndex for GreedyError, ErrorKind> { +impl DeepestIndex for GreedyError, ErrorKind> { fn depest_index(&self) -> Option { self.errors.iter().map(|(p, _k)| p.location_offset()).max() } diff --git a/rs-matter/src/cert/asn1_writer.rs b/rs-matter/src/cert/asn1_writer.rs index 7eb1c96d..bc23a221 100644 --- a/rs-matter/src/cert/asn1_writer.rs +++ b/rs-matter/src/cert/asn1_writer.rs @@ -171,7 +171,7 @@ impl<'a> ASN1Writer<'a> { } } -impl<'a> CertConsumer for ASN1Writer<'a> { +impl CertConsumer for ASN1Writer<'_> { fn start_seq(&mut self, _tag: &str) -> Result<(), Error> { self.add_compound(0x30) } diff --git a/rs-matter/src/cert/mod.rs b/rs-matter/src/cert/mod.rs index 78cee4a3..b1874a90 100644 --- a/rs-matter/src/cert/mod.rs +++ b/rs-matter/src/cert/mod.rs @@ -731,7 +731,7 @@ impl<'a> CertRef<'a> { } } -impl<'a> fmt::Display for CertRef<'a> { +impl fmt::Display for CertRef<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut printer = CertPrinter::new(f); diff --git a/rs-matter/src/cert/printer.rs b/rs-matter/src/cert/printer.rs index b037576a..0a86b1ad 100644 --- a/rs-matter/src/cert/printer.rs +++ b/rs-matter/src/cert/printer.rs @@ -45,7 +45,7 @@ const SPACE: [&str; MAX_DEPTH] = [ " ", ]; -impl<'a, 'b> CertConsumer for CertPrinter<'a, 'b> { +impl CertConsumer for CertPrinter<'_, '_> { fn start_seq(&mut self, tag: &str) -> Result<(), Error> { if !tag.is_empty() { let _ = writeln!(self.f, "{} {}", SPACE[self.level], tag); diff --git a/rs-matter/src/crypto/crypto_rustcrypto.rs b/rs-matter/src/crypto/crypto_rustcrypto.rs index 5d29b9cf..7229fb4c 100644 --- a/rs-matter/src/crypto/crypto_rustcrypto.rs +++ b/rs-matter/src/crypto/crypto_rustcrypto.rs @@ -354,19 +354,19 @@ impl<'a> SliceBuffer<'a> { } } -impl<'a> AsMut<[u8]> for SliceBuffer<'a> { +impl AsMut<[u8]> for SliceBuffer<'_> { fn as_mut(&mut self) -> &mut [u8] { &mut self.slice[..self.len] } } -impl<'a> AsRef<[u8]> for SliceBuffer<'a> { +impl AsRef<[u8]> for SliceBuffer<'_> { fn as_ref(&self) -> &[u8] { &self.slice[..self.len] } } -impl<'a> ccm::aead::Buffer for SliceBuffer<'a> { +impl ccm::aead::Buffer for SliceBuffer<'_> { fn extend_from_slice(&mut self, other: &[u8]) -> ccm::aead::Result<()> { self.slice[self.len..][..other.len()].copy_from_slice(other); self.len += other.len(); @@ -380,7 +380,7 @@ impl<'a> ccm::aead::Buffer for SliceBuffer<'a> { struct VecWriter<'a>(&'a mut alloc::vec::Vec); -impl<'a> Writer for VecWriter<'a> { +impl Writer for VecWriter<'_> { fn write(&mut self, slice: &[u8]) -> x509_cert::der::Result<()> { self.0.extend_from_slice(slice); diff --git a/rs-matter/src/data_model/core.rs b/rs-matter/src/data_model/core.rs index 601c2341..95ae54ed 100644 --- a/rs-matter/src/data_model/core.rs +++ b/rs-matter/src/data_model/core.rs @@ -745,7 +745,7 @@ where } } -impl<'a, const N: usize, B, T> ExchangeHandler for DataModel<'a, N, B, T> +impl ExchangeHandler for DataModel<'_, N, B, T> where T: DataModelHandler, B: BufferAccess, @@ -837,7 +837,7 @@ impl<'a> ReportDataReq<'a> { } } -impl<'a> WriteReqRef<'a> { +impl WriteReqRef<'_> { async fn respond( &self, handler: T, @@ -881,7 +881,7 @@ impl<'a> WriteReqRef<'a> { } } -impl<'a> InvReqRef<'a> { +impl InvReqRef<'_> { async fn respond( &self, handler: T, diff --git a/rs-matter/src/data_model/objects/cluster.rs b/rs-matter/src/data_model/objects/cluster.rs index 15a35738..b7fa3787 100644 --- a/rs-matter/src/data_model/objects/cluster.rs +++ b/rs-matter/src/data_model/objects/cluster.rs @@ -80,7 +80,7 @@ pub struct AttrDetails<'a> { pub wildcard: bool, } -impl<'a> AttrDetails<'a> { +impl AttrDetails<'_> { pub fn is_system(&self) -> bool { Attribute::is_system_attr(self.attr_id) } @@ -136,7 +136,7 @@ pub struct CmdDetails<'a> { pub wildcard: bool, } -impl<'a> CmdDetails<'a> { +impl CmdDetails<'_> { pub fn path(&self) -> CmdPath { CmdPath::new( Some(self.endpoint_id), @@ -285,7 +285,7 @@ impl<'a> Cluster<'a> { } } -impl<'a> core::fmt::Display for Cluster<'a> { +impl core::fmt::Display for Cluster<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "id:{}, ", self.id)?; write!(f, "attrs[")?; diff --git a/rs-matter/src/data_model/objects/encoder.rs b/rs-matter/src/data_model/objects/encoder.rs index 50935032..c79e416f 100644 --- a/rs-matter/src/data_model/objects/encoder.rs +++ b/rs-matter/src/data_model/objects/encoder.rs @@ -166,7 +166,7 @@ impl<'a, 'b, 'c> AttrDataWriter<'a, 'b, 'c> { } } -impl<'a, 'b, 'c> Drop for AttrDataWriter<'a, 'b, 'c> { +impl Drop for AttrDataWriter<'_, '_, '_> { fn drop(&mut self) { if !self.completed { self.reset(); @@ -174,7 +174,7 @@ impl<'a, 'b, 'c> Drop for AttrDataWriter<'a, 'b, 'c> { } } -impl<'a, 'b, 'c> Deref for AttrDataWriter<'a, 'b, 'c> { +impl<'b, 'c> Deref for AttrDataWriter<'_, 'b, 'c> { type Target = TLVWriter<'b, 'c>; fn deref(&self) -> &Self::Target { @@ -182,7 +182,7 @@ impl<'a, 'b, 'c> Deref for AttrDataWriter<'a, 'b, 'c> { } } -impl<'a, 'b, 'c> DerefMut for AttrDataWriter<'a, 'b, 'c> { +impl DerefMut for AttrDataWriter<'_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { self.tw } @@ -335,7 +335,7 @@ impl<'a, 'b, 'c> CmdDataWriter<'a, 'b, 'c> { } } -impl<'a, 'b, 'c> Drop for CmdDataWriter<'a, 'b, 'c> { +impl Drop for CmdDataWriter<'_, '_, '_> { fn drop(&mut self) { if !self.completed { self.reset(); @@ -343,7 +343,7 @@ impl<'a, 'b, 'c> Drop for CmdDataWriter<'a, 'b, 'c> { } } -impl<'a, 'b, 'c> Deref for CmdDataWriter<'a, 'b, 'c> { +impl<'b, 'c> Deref for CmdDataWriter<'_, 'b, 'c> { type Target = TLVWriter<'b, 'c>; fn deref(&self) -> &Self::Target { @@ -351,7 +351,7 @@ impl<'a, 'b, 'c> Deref for CmdDataWriter<'a, 'b, 'c> { } } -impl<'a, 'b, 'c> DerefMut for CmdDataWriter<'a, 'b, 'c> { +impl DerefMut for CmdDataWriter<'_, '_, '_> { fn deref_mut(&mut self) -> &mut Self::Target { self.tw } diff --git a/rs-matter/src/data_model/objects/endpoint.rs b/rs-matter/src/data_model/objects/endpoint.rs index 13298ecf..a4c2bd2a 100644 --- a/rs-matter/src/data_model/objects/endpoint.rs +++ b/rs-matter/src/data_model/objects/endpoint.rs @@ -40,7 +40,7 @@ impl<'a> Endpoint<'a> { } } -impl<'a> core::fmt::Display for Endpoint<'a> { +impl core::fmt::Display for Endpoint<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "clusters:[")?; let mut comma = ""; diff --git a/rs-matter/src/data_model/objects/metadata.rs b/rs-matter/src/data_model/objects/metadata.rs index 82319e06..c07806e1 100644 --- a/rs-matter/src/data_model/objects/metadata.rs +++ b/rs-matter/src/data_model/objects/metadata.rs @@ -55,7 +55,10 @@ impl Metadata for &T where T: Metadata, { - type MetadataGuard<'a> = T::MetadataGuard<'a> where Self: 'a; + type MetadataGuard<'a> + = T::MetadataGuard<'a> + where + Self: 'a; fn lock(&self) -> Self::MetadataGuard<'_> { (**self).lock() @@ -66,14 +69,17 @@ impl Metadata for &mut T where T: Metadata, { - type MetadataGuard<'a> = T::MetadataGuard<'a> where Self: 'a; + type MetadataGuard<'a> + = T::MetadataGuard<'a> + where + Self: 'a; fn lock(&self) -> Self::MetadataGuard<'_> { (**self).lock() } } -impl<'a> MetadataGuard for Node<'a> { +impl MetadataGuard for Node<'_> { fn node(&self) -> Node<'_> { Node { id: self.id, @@ -82,8 +88,11 @@ impl<'a> MetadataGuard for Node<'a> { } } -impl<'a> Metadata for Node<'a> { - type MetadataGuard<'g> = Node<'g> where Self: 'g; +impl Metadata for Node<'_> { + type MetadataGuard<'g> + = Node<'g> + where + Self: 'g; fn lock(&self) -> Self::MetadataGuard<'_> { Node { @@ -97,7 +106,8 @@ impl Metadata for (M, H) where M: Metadata, { - type MetadataGuard<'a> = M::MetadataGuard<'a> + type MetadataGuard<'a> + = M::MetadataGuard<'a> where Self: 'a; @@ -110,7 +120,8 @@ impl Metadata for HandlerCompat where T: Metadata, { - type MetadataGuard<'a> = T::MetadataGuard<'a> + type MetadataGuard<'a> + = T::MetadataGuard<'a> where Self: 'a; @@ -136,7 +147,10 @@ pub mod asynch { where T: AsyncMetadata, { - type MetadataGuard<'a> = T::MetadataGuard<'a> where Self: 'a; + type MetadataGuard<'a> + = T::MetadataGuard<'a> + where + Self: 'a; async fn lock(&self) -> Self::MetadataGuard<'_> { (**self).lock().await @@ -147,15 +161,21 @@ pub mod asynch { where T: AsyncMetadata, { - type MetadataGuard<'a> = T::MetadataGuard<'a> where Self: 'a; + type MetadataGuard<'a> + = T::MetadataGuard<'a> + where + Self: 'a; async fn lock(&self) -> Self::MetadataGuard<'_> { (**self).lock().await } } - impl<'a> AsyncMetadata for Node<'a> { - type MetadataGuard<'g> = Node<'g> where Self: 'g; + impl AsyncMetadata for Node<'_> { + type MetadataGuard<'g> + = Node<'g> + where + Self: 'g; async fn lock(&self) -> Self::MetadataGuard<'_> { Node { @@ -169,7 +189,8 @@ pub mod asynch { where M: AsyncMetadata, { - type MetadataGuard<'a> = M::MetadataGuard<'a> + type MetadataGuard<'a> + = M::MetadataGuard<'a> where Self: 'a; @@ -182,7 +203,8 @@ pub mod asynch { where T: Metadata, { - type MetadataGuard<'a> = T::MetadataGuard<'a> + type MetadataGuard<'a> + = T::MetadataGuard<'a> where Self: 'a; diff --git a/rs-matter/src/data_model/objects/node.rs b/rs-matter/src/data_model/objects/node.rs index 512845b4..788e85f2 100644 --- a/rs-matter/src/data_model/objects/node.rs +++ b/rs-matter/src/data_model/objects/node.rs @@ -56,7 +56,7 @@ impl<'a> Node<'a> { &'m self, req: &'m ReportDataReq, accessor: &'m Accessor<'m>, - ) -> Result, Error>> + 'm, Error> + ) -> Result, AttrStatus>, Error>> + 'm, Error> { let dataver_filters = req.dataver_filters()?; let fabric_filtered = req.fabric_filtered()?; @@ -82,12 +82,13 @@ impl<'a> Node<'a> { /// As part of the expansion, the method will check whether the attributes are /// accessible by the accessor and filter out the inaccessible ones (wildcard writes) /// or report an error status for the non-wildcard ones. + #[allow(clippy::type_complexity)] pub fn write<'m>( &'m self, req: &'m WriteReqRef, accessor: &'m Accessor<'m>, ) -> Result< - impl Iterator), AttrStatus>, Error>> + 'm, + impl Iterator, TLVElement<'m>), AttrStatus>, Error>> + 'm, Error, > { Ok(PathExpander::new( @@ -103,12 +104,13 @@ impl<'a> Node<'a> { /// As part of the expansion, the method will check whether the commands are /// accessible by the accessor and filter out the inaccessible ones (wildcard invocations) /// or report an error status for the non-wildcard ones. + #[allow(clippy::type_complexity)] pub fn invoke<'m>( &'m self, req: &'m InvReqRef, accessor: &'m Accessor<'m>, ) -> Result< - impl Iterator), CmdStatus>, Error>> + 'm, + impl Iterator, TLVElement<'m>), CmdStatus>, Error>> + 'm, Error, > { Ok(PathExpander::new( @@ -119,7 +121,7 @@ impl<'a> Node<'a> { } } -impl<'a> core::fmt::Display for Node<'a> { +impl core::fmt::Display for Node<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f, "node:")?; for (index, endpoint) in self.endpoints.iter().enumerate() { @@ -180,7 +182,7 @@ impl<'a, const N: usize> DynamicNode<'a, N> { } } -impl<'a, const N: usize> core::fmt::Display for DynamicNode<'a, N> { +impl core::fmt::Display for DynamicNode<'_, N> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.node().fmt(f) } @@ -653,8 +655,7 @@ mod test { let fab_mgr = RefCell::new(FabricMgr::new()); let accessor = Accessor::new(0, AccessorSubjects::new(0), AuthMode::Pase, &fab_mgr); - let expander = - PathExpander::new(&node, &accessor, Some(input.into_iter().cloned().map(Ok))); + let expander = PathExpander::new(node, &accessor, Some(input.iter().cloned().map(Ok))); assert_eq!( expander diff --git a/rs-matter/src/data_model/sdm/thread_nw_diagnostics.rs b/rs-matter/src/data_model/sdm/thread_nw_diagnostics.rs index b52e879f..01c6841c 100644 --- a/rs-matter/src/data_model/sdm/thread_nw_diagnostics.rs +++ b/rs-matter/src/data_model/sdm/thread_nw_diagnostics.rs @@ -459,7 +459,7 @@ impl<'a> ThreadNwDiagCluster<'a> { } } -impl<'a> Handler for ThreadNwDiagCluster<'a> { +impl Handler for ThreadNwDiagCluster<'_> { fn read( &self, exchange: &Exchange, @@ -484,4 +484,4 @@ impl<'a> Handler for ThreadNwDiagCluster<'a> { } } -impl<'a> NonBlockingHandler for ThreadNwDiagCluster<'a> {} +impl NonBlockingHandler for ThreadNwDiagCluster<'_> {} diff --git a/rs-matter/src/data_model/system_model/access_control.rs b/rs-matter/src/data_model/system_model/access_control.rs index 2b1f9434..b2fe87b7 100644 --- a/rs-matter/src/data_model/system_model/access_control.rs +++ b/rs-matter/src/data_model/system_model/access_control.rs @@ -327,13 +327,7 @@ mod tests { &verifier[0] ); assert_eq!( - fab_mgr - .get(FAB_2) - .unwrap() - .acl_iter() - .skip(1) - .next() - .unwrap(), + fab_mgr.get(FAB_2).unwrap().acl_iter().nth(1).unwrap(), &verifier[2] ); } diff --git a/rs-matter/src/data_model/system_model/descriptor.rs b/rs-matter/src/data_model/system_model/descriptor.rs index cbeca61e..0fa4cb28 100644 --- a/rs-matter/src/data_model/system_model/descriptor.rs +++ b/rs-matter/src/data_model/system_model/descriptor.rs @@ -241,7 +241,7 @@ impl<'a> DescriptorCluster<'a> { } } -impl<'a> Handler for DescriptorCluster<'a> { +impl Handler for DescriptorCluster<'_> { fn read( &self, exchange: &Exchange, @@ -252,9 +252,9 @@ impl<'a> Handler for DescriptorCluster<'a> { } } -impl<'a> NonBlockingHandler for DescriptorCluster<'a> {} +impl NonBlockingHandler for DescriptorCluster<'_> {} -impl<'a> ChangeNotifier<()> for DescriptorCluster<'a> { +impl ChangeNotifier<()> for DescriptorCluster<'_> { fn consume_change(&mut self) -> Option<()> { self.data_ver.consume_change(()) } diff --git a/rs-matter/src/interaction_model/messages.rs b/rs-matter/src/interaction_model/messages.rs index 1d51dc41..2159c388 100644 --- a/rs-matter/src/interaction_model/messages.rs +++ b/rs-matter/src/interaction_model/messages.rs @@ -444,7 +444,7 @@ pub mod ib { Status(CmdStatus), } - impl<'a> CmdResp<'a> { + impl CmdResp<'_> { pub fn status_new(cmd_path: CmdPath, status: IMStatusCode, cluster_status: u16) -> Self { Self::Status(CmdStatus { path: cmd_path, @@ -464,7 +464,7 @@ pub mod ib { Status = 1, } - impl<'a> From for CmdResp<'a> { + impl From for CmdResp<'_> { fn from(value: CmdStatus) -> Self { Self::Status(value) } @@ -547,7 +547,7 @@ pub mod ib { } } - impl<'a> From for AttrResp<'a> { + impl From for AttrResp<'_> { fn from(value: AttrStatus) -> Self { Self::Status(value) } diff --git a/rs-matter/src/mdns.rs b/rs-matter/src/mdns.rs index 990c39a3..810d2f7f 100644 --- a/rs-matter/src/mdns.rs +++ b/rs-matter/src/mdns.rs @@ -140,7 +140,7 @@ impl<'a> MdnsImpl<'a> { } } -impl<'a> Mdns for MdnsImpl<'a> { +impl Mdns for MdnsImpl<'_> { fn reset(&self) { match self.service { MdnsService::Disabled => {} diff --git a/rs-matter/src/mdns/builtin.rs b/rs-matter/src/mdns/builtin.rs index 6a014f52..3ea5959b 100644 --- a/rs-matter/src/mdns/builtin.rs +++ b/rs-matter/src/mdns/builtin.rs @@ -270,7 +270,7 @@ impl<'a> MdnsImpl<'a> { } } -impl<'a> Services for MdnsImpl<'a> { +impl Services for MdnsImpl<'_> { fn for_each(&self, callback: F) -> Result<(), Error> where F: FnMut(&Service) -> Result<(), Error>, diff --git a/rs-matter/src/mdns/proto.rs b/rs-matter/src/mdns/proto.rs index 8bdfcb37..806cacfd 100644 --- a/rs-matter/src/mdns/proto.rs +++ b/rs-matter/src/mdns/proto.rs @@ -105,7 +105,7 @@ pub struct Host<'a> { pub ipv6: Ipv6Addr, } -impl<'a> Host<'a> { +impl Host<'_> { /// Broadcast an mDNS packet with the host and its services /// /// Should be done pro-actively every time there is a change in the host @@ -464,7 +464,7 @@ impl<'a> Host<'a> { } } -impl<'a> Service<'a> { +impl Service<'_> { fn add_service( &self, answer: &mut R, @@ -668,9 +668,9 @@ impl<'a> Service<'a> { struct Buf<'a>(pub &'a mut [u8], pub usize); -impl<'a> Composer for Buf<'a> {} +impl Composer for Buf<'_> {} -impl<'a> OctetsBuilder for Buf<'a> { +impl OctetsBuilder for Buf<'_> { type AppendError = ShortBuf; fn append_slice(&mut self, slice: &[u8]) -> Result<(), Self::AppendError> { @@ -686,19 +686,19 @@ impl<'a> OctetsBuilder for Buf<'a> { } } -impl<'a> Truncate for Buf<'a> { +impl Truncate for Buf<'_> { fn truncate(&mut self, len: usize) { self.1 = len; } } -impl<'a> AsMut<[u8]> for Buf<'a> { +impl AsMut<[u8]> for Buf<'_> { fn as_mut(&mut self) -> &mut [u8] { &mut self.0[..self.1] } } -impl<'a> AsRef<[u8]> for Buf<'a> { +impl AsRef<[u8]> for Buf<'_> { fn as_ref(&self) -> &[u8] { &self.0[..self.1] } @@ -903,7 +903,7 @@ mod tests { tests: &'a [(&'a [Question<'a>], &'a [Answer<'a>], &'a [Answer<'a>])], } - impl<'a> TestRun<'a> { + impl TestRun<'_> { fn run(&self) { let mut buf1 = [0; 1500]; let mut buf2 = [0; 1500]; @@ -937,7 +937,7 @@ mod tests { qtype: Rtype, } - impl<'a> Question<'a> { + impl Question<'_> { fn prep<'b>(buf: &'b mut [u8], id: u16, questions: &[Question]) -> &'b [u8] { let message = MessageBuilder::from_target(Buf(buf, 0)).unwrap(); @@ -981,7 +981,7 @@ mod tests { details: AnswerDetails<'a>, } - impl<'a> Answer<'a> { + impl Answer<'_> { fn validate( data: &[u8], expected_id: u16, diff --git a/rs-matter/src/secure_channel/crypto_mbedtls.rs b/rs-matter/src/secure_channel/crypto_mbedtls.rs index 8bbc2c00..91d3b83f 100644 --- a/rs-matter/src/secure_channel/crypto_mbedtls.rs +++ b/rs-matter/src/secure_channel/crypto_mbedtls.rs @@ -51,7 +51,6 @@ const MATTER_N_BIN: [u8; 65] = [ ]; #[allow(non_snake_case)] - pub struct CryptoSpake2 { group: EcGroup, order: Mpi, diff --git a/rs-matter/src/secure_channel/crypto_openssl.rs b/rs-matter/src/secure_channel/crypto_openssl.rs index 4254e6f2..b1d56bb6 100644 --- a/rs-matter/src/secure_channel/crypto_openssl.rs +++ b/rs-matter/src/secure_channel/crypto_openssl.rs @@ -45,7 +45,6 @@ const MATTER_N_BIN: [u8; 65] = [ ]; #[allow(non_snake_case)] - pub struct CryptoSpake2 { group: EcGroup, bn_ctx: BigNumContext, diff --git a/rs-matter/src/secure_channel/crypto_rustcrypto.rs b/rs-matter/src/secure_channel/crypto_rustcrypto.rs index a5b3ad86..623e8a5f 100644 --- a/rs-matter/src/secure_channel/crypto_rustcrypto.rs +++ b/rs-matter/src/secure_channel/crypto_rustcrypto.rs @@ -45,7 +45,6 @@ const MATTER_N_BIN: [u8; 65] = [ ]; #[allow(non_snake_case)] - pub struct CryptoSpake2 { xy: p256::Scalar, w0: p256::Scalar, diff --git a/rs-matter/src/tlv.rs b/rs-matter/src/tlv.rs index 6bf66a17..0add5e3e 100644 --- a/rs-matter/src/tlv.rs +++ b/rs-matter/src/tlv.rs @@ -646,7 +646,7 @@ impl IntoIterator for TLVTag { } } -impl<'a> IntoIterator for &'a TLVTag { +impl IntoIterator for &TLVTag { type Item = u8; type IntoIter = TLVTagIter; @@ -1021,7 +1021,7 @@ impl<'a> IntoIterator for TLVValue<'a> { } } -impl<'s, 'a> IntoIterator for &'s TLVValue<'a> { +impl<'a> IntoIterator for &TLVValue<'a> { type Item = u8; type IntoIter = TLVValueIter<'a, Self>; @@ -1110,7 +1110,7 @@ where } } -impl<'a> fmt::Display for TLVValue<'a> { +impl fmt::Display for TLVValue<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.fmt(f) } diff --git a/rs-matter/src/tlv/read.rs b/rs-matter/src/tlv/read.rs index cf485027..01e87c9b 100644 --- a/rs-matter/src/tlv/read.rs +++ b/rs-matter/src/tlv/read.rs @@ -705,13 +705,13 @@ impl<'a> TLVElement<'a> { } } -impl<'a> fmt::Debug for TLVElement<'a> { +impl fmt::Debug for TLVElement<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt(0, f) } } -impl<'a> fmt::Display for TLVElement<'a> { +impl fmt::Display for TLVElement<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt(0, f) } @@ -930,7 +930,7 @@ impl<'a> TLVSequence<'a> { return Ok(TLVElement(Self::EMPTY)); } - return Ok(TLVElement::new(self.0)); + Ok(TLVElement::new(self.0)) } /// Return the TLV control byte of the first TLV in the sequence. @@ -1128,13 +1128,13 @@ impl<'a> TLVSequence<'a> { } } -impl<'a> fmt::Debug for TLVSequence<'a> { +impl fmt::Debug for TLVSequence<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt(0, f) } } -impl<'a> fmt::Display for TLVSequence<'a> { +impl fmt::Display for TLVSequence<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.fmt(0, f) } @@ -1219,13 +1219,13 @@ impl<'a> Iterator for TLVSequenceIter<'a> { } } -impl<'a> fmt::Debug for TLVSequenceIter<'a> { +impl fmt::Debug for TLVSequenceIter<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(0, f) } } -impl<'a> fmt::Display for TLVSequenceIter<'a> { +impl fmt::Display for TLVSequenceIter<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.0.fmt(0, f) } diff --git a/rs-matter/src/tlv/traits.rs b/rs-matter/src/tlv/traits.rs index 36bdb4d6..2bfabdae 100644 --- a/rs-matter/src/tlv/traits.rs +++ b/rs-matter/src/tlv/traits.rs @@ -88,7 +88,7 @@ impl<'a> FromTLV<'a> for TLVElement<'a> { } } -impl<'a> ToTLV for TLVElement<'a> { +impl ToTLV for TLVElement<'_> { fn to_tlv(&self, tag: &TLVTag, mut tw: W) -> Result<(), Error> { if self.is_empty() { // Special-case serializing empty TLV elements to nothing @@ -151,7 +151,7 @@ impl<'a> FromTLV<'a> for TLVValue<'a> { } } -impl<'a> ToTLV for TLVValue<'a> { +impl ToTLV for TLVValue<'_> { fn to_tlv(&self, tag: &TLVTag, mut tw: W) -> Result<(), Error> { tw.tlv(tag, self) } diff --git a/rs-matter/src/tlv/traits/container.rs b/rs-matter/src/tlv/traits/container.rs index c6c2bc08..84109e35 100644 --- a/rs-matter/src/tlv/traits/container.rs +++ b/rs-matter/src/tlv/traits/container.rs @@ -205,7 +205,7 @@ where } } -impl<'a, T, C> ToTLV for TLVContainer<'a, T, C> { +impl ToTLV for TLVContainer<'_, T, C> { fn to_tlv(&self, tag: &TLVTag, tw: W) -> Result<(), Error> { self.element.to_tlv(tag, tw) } diff --git a/rs-matter/src/tlv/traits/octets.rs b/rs-matter/src/tlv/traits/octets.rs index b3c53d99..eb5f5916 100644 --- a/rs-matter/src/tlv/traits/octets.rs +++ b/rs-matter/src/tlv/traits/octets.rs @@ -57,7 +57,7 @@ impl<'a> Octets<'a> { } } -impl<'a> Deref for Octets<'a> { +impl Deref for Octets<'_> { type Target = [u8]; fn deref(&self) -> &Self::Target { @@ -71,7 +71,7 @@ impl<'a> FromTLV<'a> for Octets<'a> { } } -impl<'a> ToTLV for Octets<'a> { +impl ToTLV for Octets<'_> { fn to_tlv(&self, tag: &TLVTag, mut tw: W) -> Result<(), Error> { tw.str(tag, self.0) } diff --git a/rs-matter/src/tlv/traits/slice.rs b/rs-matter/src/tlv/traits/slice.rs index 869b2059..ac0c4674 100644 --- a/rs-matter/src/tlv/traits/slice.rs +++ b/rs-matter/src/tlv/traits/slice.rs @@ -37,7 +37,7 @@ use super::{TLVTag, TLVValue, TLVWrite, ToTLV, TLV}; /// Therefore, use `Slice<'a, T>` instead of `&'a [T]` as a syntax in your structs. pub type Slice<'a, T> = &'a [T]; -impl<'a, T: ToTLV> ToTLV for &'a [T] +impl ToTLV for &[T] where T: ToTLV, { diff --git a/rs-matter/src/tlv/write.rs b/rs-matter/src/tlv/write.rs index 9e8ce7cb..63e2ba6e 100644 --- a/rs-matter/src/tlv/write.rs +++ b/rs-matter/src/tlv/write.rs @@ -67,7 +67,7 @@ impl<'a, 'b> TLVWriter<'a, 'b> { } } -impl<'a, 'b> TLVWrite for TLVWriter<'a, 'b> { +impl TLVWrite for TLVWriter<'_, '_> { type Position = usize; fn write(&mut self, byte: u8) -> Result<(), Error> { @@ -424,7 +424,7 @@ where } } -impl<'a> TLVWrite for WriteBuf<'a> { +impl TLVWrite for WriteBuf<'_> { type Position = usize; fn write(&mut self, byte: u8) -> Result<(), Error> { @@ -440,7 +440,7 @@ impl<'a> TLVWrite for WriteBuf<'a> { } } -impl<'a> WriteBuf<'a> { +impl WriteBuf<'_> { /// Write a tag and a TLV Octet String to the TLV stream, where the Octet String is a slice of u8 bytes. /// /// The writing is done via a user-supplied callback `cb`, that is expected to fill the provided buffer with the data diff --git a/rs-matter/src/transport/core.rs b/rs-matter/src/transport/core.rs index 68d2ade1..bde905f8 100644 --- a/rs-matter/src/transport/core.rs +++ b/rs-matter/src/transport/core.rs @@ -170,7 +170,7 @@ impl<'m> TransportMgr<'m> { fabric_idx: u8, peer_node_id: u64, secure: bool, - ) -> Result, Error> { + ) -> Result, Error> { // TODO: Future: once we have mDNS lookups in place // create a new session if no suitable one is found @@ -192,7 +192,7 @@ impl<'m> TransportMgr<'m> { &'a self, matter: &'a Matter<'a>, session_id: u32, - ) -> Result, Error> { + ) -> Result, Error> { let mut session_mgr = self.session_mgr.borrow_mut(); session_mgr.get(session_id).ok_or(ErrorCode::NoSession)?; @@ -219,7 +219,7 @@ impl<'m> TransportMgr<'m> { &'a self, matter: &'a Matter<'a>, mut f: F, - ) -> Result, Error> + ) -> Result, Error> where F: FnMut(&Session, &ExchangeState, &Packet) -> bool, { @@ -1076,7 +1076,7 @@ impl Packet { pub fn display<'a>(peer: &'a Address, header: &'a PacketHdr) -> impl Display + 'a { struct PacketInfo<'a>(&'a Address, &'a PacketHdr); - impl<'a> Display for PacketInfo<'a> { + impl Display for PacketInfo<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { Packet::<0>::fmt(f, self.0, self.1) } @@ -1088,7 +1088,7 @@ impl Packet { pub fn display_payload<'a>(proto: &'a ProtoHdr, buf: &'a [u8]) -> impl Display + 'a { struct PacketInfo<'a>(&'a ProtoHdr, &'a [u8]); - impl<'a> Display for PacketInfo<'a> { + impl Display for PacketInfo<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { Packet::<0>::fmt_payload(f, self.0, self.1) } @@ -1224,13 +1224,13 @@ impl DerefMut for PacketBuffer { // This type is only known and used by `TransportMgr` and the `exchange` module pub(crate) struct PacketAccess<'a, const N: usize>(IfMutexGuard<'a, NoopRawMutex, Packet>, bool); -impl<'a, const N: usize> PacketAccess<'a, N> { +impl PacketAccess<'_, N> { pub fn clear_on_drop(&mut self, clear: bool) { self.1 = clear; } } -impl<'a, const N: usize> Deref for PacketAccess<'a, N> { +impl Deref for PacketAccess<'_, N> { type Target = Packet; fn deref(&self) -> &Self::Target { @@ -1238,13 +1238,13 @@ impl<'a, const N: usize> Deref for PacketAccess<'a, N> { } } -impl<'a, const N: usize> DerefMut for PacketAccess<'a, N> { +impl DerefMut for PacketAccess<'_, N> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } -impl<'a, const N: usize> Drop for PacketAccess<'a, N> { +impl Drop for PacketAccess<'_, N> { fn drop(&mut self) { if self.1 { self.buf.clear(); @@ -1252,7 +1252,7 @@ impl<'a, const N: usize> Drop for PacketAccess<'a, N> { } } -impl<'a, const N: usize> Display for PacketAccess<'a, N> { +impl Display for PacketAccess<'_, N> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } @@ -1266,8 +1266,11 @@ pub(crate) struct PacketBufferExternalAccess<'a, const N: usize>( pub(crate) &'a IfMutex>, ); -impl<'a, const N: usize> BufferAccess<[u8]> for PacketBufferExternalAccess<'a, N> { - type Buffer<'b> = ExternalPacketBuffer<'b, N> where Self: 'b; +impl BufferAccess<[u8]> for PacketBufferExternalAccess<'_, N> { + type Buffer<'b> + = ExternalPacketBuffer<'b, N> + where + Self: 'b; async fn get(&self) -> Option> { let mut packet = self.0.lock_if(|packet| packet.buf.is_empty()).await; @@ -1283,7 +1286,7 @@ impl<'a, const N: usize> BufferAccess<[u8]> for PacketBufferExternalAccess<'a, N // Wraps the RX or TX packet of the transport manager in something that looks like a `&mut [u8]` buffer. pub struct ExternalPacketBuffer<'a, const N: usize>(IfMutexGuard<'a, NoopRawMutex, Packet>); -impl<'a, const N: usize> Deref for ExternalPacketBuffer<'a, N> { +impl Deref for ExternalPacketBuffer<'_, N> { type Target = [u8]; fn deref(&self) -> &Self::Target { @@ -1291,13 +1294,13 @@ impl<'a, const N: usize> Deref for ExternalPacketBuffer<'a, N> { } } -impl<'a, const N: usize> DerefMut for ExternalPacketBuffer<'a, N> { +impl DerefMut for ExternalPacketBuffer<'_, N> { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0.buf } } -impl<'a, const N: usize> Drop for ExternalPacketBuffer<'a, N> { +impl Drop for ExternalPacketBuffer<'_, N> { fn drop(&mut self) { self.0.buf.clear(); } diff --git a/rs-matter/src/transport/exchange.rs b/rs-matter/src/transport/exchange.rs index cd26ea5d..f3214433 100644 --- a/rs-matter/src/transport/exchange.rs +++ b/rs-matter/src/transport/exchange.rs @@ -299,7 +299,7 @@ pub struct ExchangeIdDisplay<'a> { session: &'a Session, } -impl<'a> Display for ExchangeIdDisplay<'a> { +impl Display for ExchangeIdDisplay<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let state = self.session.exchanges[self.id.exchange_index()].as_ref(); @@ -530,7 +530,7 @@ impl Display for MessageMeta { /// An RX message pending on an `Exchange` instance. pub struct RxMessage<'a>(PacketAccess<'a, MAX_RX_BUF_SIZE>); -impl<'a> RxMessage<'a> { +impl RxMessage<'_> { /// Get the meta-data of the pending message pub fn meta(&self) -> MessageMeta { MessageMeta::from(&self.0.header.proto) @@ -555,7 +555,7 @@ pub struct TxMessage<'a> { packet: PacketAccess<'a, MAX_TX_BUF_SIZE>, } -impl<'a> TxMessage<'a> { +impl TxMessage<'_> { /// Get a reference to the payload buffer of the TX message being built pub fn payload(&mut self) -> &mut [u8] { &mut self.packet.buf[PacketHdr::HDR_RESERVE..MAX_TX_BUF_SIZE - PacketHdr::TAIL_RESERVE] @@ -660,7 +660,7 @@ pub struct SenderTx<'a, 'b> { message: TxMessage<'a>, } -impl<'a, 'b> SenderTx<'a, 'b> { +impl SenderTx<'_, '_> { pub fn split(&mut self) -> (&Exchange<'_>, &mut [u8]) { (self.sender.exchange, self.message.payload()) } @@ -1114,7 +1114,7 @@ impl<'a> Exchange<'a> { } } -impl<'a> Drop for Exchange<'a> { +impl Drop for Exchange<'_> { fn drop(&mut self) { let closed = self.with_ctx(|sess, exch_index| Ok(sess.remove_exch(exch_index))); @@ -1124,7 +1124,7 @@ impl<'a> Drop for Exchange<'a> { } } -impl<'a> Display for Exchange<'a> { +impl Display for Exchange<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.id) } diff --git a/rs-matter/src/transport/network/btp/context.rs b/rs-matter/src/transport/network/btp/context.rs index 8634dff9..9269e526 100644 --- a/rs-matter/src/transport/network/btp/context.rs +++ b/rs-matter/src/transport/network/btp/context.rs @@ -137,7 +137,7 @@ where } } -impl<'a, M> Drop for SessionSendLock<'a, M> +impl Drop for SessionSendLock<'_, M> where M: RawMutex, { diff --git a/rs-matter/src/transport/session.rs b/rs-matter/src/transport/session.rs index 7dfc0144..fcb09ef3 100644 --- a/rs-matter/src/transport/session.rs +++ b/rs-matter/src/transport/session.rs @@ -467,7 +467,7 @@ impl<'a> ReservedSession<'a> { }) } - pub async fn reserve(matter: &'a Matter<'a>) -> Result, Error> { + pub async fn reserve(matter: &'a Matter<'a>) -> Result, Error> { let session = Self::reserve_now(matter); if let Ok(session) = session { @@ -522,7 +522,7 @@ impl<'a> ReservedSession<'a> { } } -impl<'a> Drop for ReservedSession<'a> { +impl Drop for ReservedSession<'_> { fn drop(&mut self) { if self.complete { let mut session_mgr = self.session_mgr.borrow_mut(); diff --git a/rs-matter/src/utils/storage/pooled.rs b/rs-matter/src/utils/storage/pooled.rs index a980902d..71ff8d18 100644 --- a/rs-matter/src/utils/storage/pooled.rs +++ b/rs-matter/src/utils/storage/pooled.rs @@ -49,7 +49,10 @@ where B: BufferAccess, T: ?Sized, { - type Buffer<'a> = B::Buffer<'a> where Self: 'a; + type Buffer<'a> + = B::Buffer<'a> + where + Self: 'a; async fn get(&self) -> Option> { (*self).get().await @@ -99,7 +102,10 @@ where M: RawMutex, T: Default + Clone, { - type Buffer<'b> = PooledBuffer<'b, N, M, T> where Self: 'b; + type Buffer<'b> + = PooledBuffer<'b, N, M, T> + where + Self: 'b; async fn get(&self) -> Option> { if self.wait_timeout_ms > 0 { @@ -165,7 +171,7 @@ where access: &'a PooledBuffers, } -impl<'a, const N: usize, M, T> Drop for PooledBuffer<'a, N, M, T> +impl Drop for PooledBuffer<'_, N, M, T> where M: RawMutex, { @@ -177,7 +183,7 @@ where } } -impl<'a, const N: usize, M, T> Deref for PooledBuffer<'a, N, M, T> +impl Deref for PooledBuffer<'_, N, M, T> where M: RawMutex, { @@ -188,7 +194,7 @@ where } } -impl<'a, const N: usize, M, T> DerefMut for PooledBuffer<'a, N, M, T> +impl DerefMut for PooledBuffer<'_, N, M, T> where M: RawMutex, { diff --git a/rs-matter/src/utils/sync/mutex.rs b/rs-matter/src/utils/sync/mutex.rs index ab7590a0..54d882b8 100644 --- a/rs-matter/src/utils/sync/mutex.rs +++ b/rs-matter/src/utils/sync/mutex.rs @@ -195,7 +195,7 @@ where mutex: &'a IfMutex, } -impl<'a, M, T> Drop for IfMutexGuard<'a, M, T> +impl Drop for IfMutexGuard<'_, M, T> where M: RawMutex, T: ?Sized, @@ -211,7 +211,7 @@ where } } -impl<'a, M, T> Deref for IfMutexGuard<'a, M, T> +impl Deref for IfMutexGuard<'_, M, T> where M: RawMutex, T: ?Sized, @@ -225,7 +225,7 @@ where } } -impl<'a, M, T> DerefMut for IfMutexGuard<'a, M, T> +impl DerefMut for IfMutexGuard<'_, M, T> where M: RawMutex, T: ?Sized, diff --git a/rs-matter/tests/common/e2e.rs b/rs-matter/tests/common/e2e.rs index cbc54d32..ed5d78b0 100644 --- a/rs-matter/tests/common/e2e.rs +++ b/rs-matter/tests/common/e2e.rs @@ -281,7 +281,7 @@ type NetworkPipe<'a, const N: usize> = Channel<'a, NoopRawMutex, heapless::Vec(Receiver<'a, NoopRawMutex, heapless::Vec>); -impl<'a, const N: usize> NetworkSend for NetworkSendImpl<'a, N> { +impl NetworkSend for NetworkSendImpl<'_, N> { async fn send_to(&mut self, data: &[u8], _addr: Address) -> Result<(), Error> { let vec = self.0.send().await; @@ -296,7 +296,7 @@ impl<'a, const N: usize> NetworkSend for NetworkSendImpl<'a, N> { struct NetworkSendImpl<'a, const N: usize>(Sender<'a, NoopRawMutex, heapless::Vec>); -impl<'a, const N: usize> NetworkReceive for NetworkReceiveImpl<'a, N> { +impl NetworkReceive for NetworkReceiveImpl<'_, N> { async fn wait_available(&mut self) -> Result<(), Error> { self.0.receive().await; diff --git a/rs-matter/tests/common/e2e/im.rs b/rs-matter/tests/common/e2e/im.rs index 924f2d81..154ae631 100644 --- a/rs-matter/tests/common/e2e/im.rs +++ b/rs-matter/tests/common/e2e/im.rs @@ -239,7 +239,7 @@ impl<'a> TestReportDataMsg<'a> { } } -impl<'a> TestToTLV for TestReportDataMsg<'a> { +impl TestToTLV for TestReportDataMsg<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; @@ -304,7 +304,7 @@ impl<'a> TestInvReq<'a> { } } -impl<'a> TestToTLV for TestInvReq<'a> { +impl TestToTLV for TestInvReq<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; @@ -351,7 +351,7 @@ impl<'a> TestInvResp<'a> { } } -impl<'a> TestToTLV for TestInvResp<'a> { +impl TestToTLV for TestInvResp<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; diff --git a/rs-matter/tests/common/e2e/im/attributes.rs b/rs-matter/tests/common/e2e/im/attributes.rs index 0b751e31..793095cc 100644 --- a/rs-matter/tests/common/e2e/im/attributes.rs +++ b/rs-matter/tests/common/e2e/im/attributes.rs @@ -90,7 +90,7 @@ impl<'a> TestAttrData<'a> { } } -impl<'a> TestToTLV for TestAttrData<'a> { +impl TestToTLV for TestAttrData<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; @@ -125,7 +125,7 @@ impl<'a> TestAttrResp<'a> { } } -impl<'a> TestToTLV for TestAttrResp<'a> { +impl TestToTLV for TestAttrResp<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; diff --git a/rs-matter/tests/common/e2e/im/commands.rs b/rs-matter/tests/common/e2e/im/commands.rs index 568dded3..fcd5d4f2 100644 --- a/rs-matter/tests/common/e2e/im/commands.rs +++ b/rs-matter/tests/common/e2e/im/commands.rs @@ -78,7 +78,7 @@ impl<'a> TestCmdData<'a> { } } -impl<'a> TestToTLV for TestCmdData<'a> { +impl TestToTLV for TestCmdData<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; @@ -102,7 +102,7 @@ pub enum TestCmdResp<'a> { Status(CmdStatus), } -impl<'a> TestToTLV for TestCmdResp<'a> { +impl TestToTLV for TestCmdResp<'_> { fn test_to_tlv(&self, tag: &TLVTag, tw: &mut TLVWriter) -> Result<(), Error> { tw.start_struct(tag)?; diff --git a/rs-matter/tests/common/e2e/im/handler.rs b/rs-matter/tests/common/e2e/im/handler.rs index 59049b60..09959ff6 100644 --- a/rs-matter/tests/common/e2e/im/handler.rs +++ b/rs-matter/tests/common/e2e/im/handler.rs @@ -109,7 +109,7 @@ impl<'a> E2eTestHandler<'a> { } } -impl<'a> Handler for E2eTestHandler<'a> { +impl Handler for E2eTestHandler<'_> { fn read( &self, exchange: &Exchange, @@ -139,9 +139,9 @@ impl<'a> Handler for E2eTestHandler<'a> { } } -impl<'a> NonBlockingHandler for E2eTestHandler<'a> {} +impl NonBlockingHandler for E2eTestHandler<'_> {} -impl<'a> AsyncHandler for E2eTestHandler<'a> { +impl AsyncHandler for E2eTestHandler<'_> { async fn read( &self, exchange: &Exchange<'_>, @@ -183,16 +183,22 @@ impl<'a> AsyncHandler for E2eTestHandler<'a> { } } -impl<'a> Metadata for E2eTestHandler<'a> { - type MetadataGuard<'g> = Node<'g> where Self: 'g; +impl Metadata for E2eTestHandler<'_> { + type MetadataGuard<'g> + = Node<'g> + where + Self: 'g; fn lock(&self) -> Self::MetadataGuard<'_> { Self::NODE } } -impl<'a> AsyncMetadata for E2eTestHandler<'a> { - type MetadataGuard<'g> = Node<'g> where Self: 'g; +impl AsyncMetadata for E2eTestHandler<'_> { + type MetadataGuard<'g> + = Node<'g> + where + Self: 'g; async fn lock(&self) -> Self::MetadataGuard<'_> { Self::NODE