Skip to content

Commit

Permalink
Make Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed May 8, 2024
1 parent 7d128ac commit 0978a98
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 2 deletions.
6 changes: 6 additions & 0 deletions rs-matter/src/acl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ pub struct AclMgr {
changed: bool,
}

impl Default for AclMgr {
fn default() -> Self {
Self::new()
}
}

impl AclMgr {
#[inline(always)]
pub const fn new() -> Self {
Expand Down
6 changes: 6 additions & 0 deletions rs-matter/src/data_model/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ pub struct Subscriptions<const N: usize> {
pub(crate) notification: Notification<NoopRawMutex>,
}

impl<const N: usize> Default for Subscriptions<N> {
fn default() -> Self {
Self::new()
}
}

impl<const N: usize> Subscriptions<N> {
/// Create the instance.
#[inline(always)]
Expand Down
6 changes: 6 additions & 0 deletions rs-matter/src/fabric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ pub struct FabricMgr {
changed: bool,
}

impl Default for FabricMgr {
fn default() -> Self {
Self::new()
}
}

impl FabricMgr {
#[inline(always)]
pub const fn new() -> Self {
Expand Down
6 changes: 6 additions & 0 deletions rs-matter/src/interaction_model/busy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ use super::{
/// not accepted in time by the actual Interaction Model responder, due to all its handlers being occupied with work.
pub struct BusyInteractionModel(());

impl Default for BusyInteractionModel {
fn default() -> Self {
Self::new()
}
}

impl BusyInteractionModel {
#[inline(always)]
pub const fn new() -> Self {
Expand Down
6 changes: 6 additions & 0 deletions rs-matter/src/secure_channel/busy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ use super::common::{sc_write, OpCode, SCStatusCodes, PROTO_ID_SECURE_CHANNEL};
/// not accepted in time by the actual Secure Channel responder, due to all its handlers being occupied with work.
pub struct BusySecureChannel(());

impl Default for BusySecureChannel {
fn default() -> Self {
Self::new()
}
}

impl BusySecureChannel {
const BUSY_RETRY_DELAY_MS: u16 = 500;

Expand Down
6 changes: 6 additions & 0 deletions rs-matter/src/secure_channel/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ pub struct CaseSession {
local_fabric_idx: usize,
}

impl Default for CaseSession {
fn default() -> Self {
Self::new()
}
}

impl CaseSession {
#[inline(always)]
pub const fn new() -> Self {
Expand Down
2 changes: 1 addition & 1 deletion rs-matter/src/transport/exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ pub struct SenderTx<'a, 'b> {

impl<'a, 'b> SenderTx<'a, 'b> {
pub fn split(&mut self) -> (&Exchange<'_>, &mut [u8]) {
(&self.sender.exchange, self.message.payload())
(self.sender.exchange, self.message.payload())
}

pub fn payload(&mut self) -> &mut [u8] {
Expand Down
1 change: 0 additions & 1 deletion rs-matter/src/utils/ifmutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use super::signal::Signal;

/// Error returned by [`Mutex::try_lock`]
#[derive(PartialEq, Eq, Clone, Copy, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct TryLockError;

/// Async mutex with conditional locking based on the data inside the mutex.
Expand Down
9 changes: 9 additions & 0 deletions rs-matter/src/utils/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ use super::signal::Signal;
/// A notification primitive that allows for notifying a single waiter.
pub struct Notification<M>(Signal<M, Option<()>>);

impl<M> Default for Notification<M>
where
M: RawMutex,
{
fn default() -> Self {
Self::new()
}
}

impl<M> Notification<M>
where
M: RawMutex,
Expand Down

0 comments on commit 0978a98

Please sign in to comment.