Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few clippy warnings #108

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Writes {
.write_service(self, value.as_slice())
.await
.and_then(|(data, working_counter)| {
let res = T::try_from_slice(&*data).map_err(|e| {
let res = T::try_from_slice(&data).map_err(|e| {
fmt::error!(
"PDU data decode: {:?}, T: {} data {:?}",
e,
Expand Down Expand Up @@ -220,7 +220,7 @@ impl Reads {
.read_service(self, T::LEN)
.await
.and_then(|(data, working_counter)| {
let res = T::try_from_slice(&*data).map_err(|e| {
let res = T::try_from_slice(&data).map_err(|e| {
fmt::error!(
"PDU data decode: {:?}, T: {} data {:?}",
e,
Expand Down
4 changes: 2 additions & 2 deletions src/dc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn latch_dc_times(client: &Client<'_>, slaves: &mut [Slave]) -> Result<(),

// Latch receive times into all ports of all slaves.
Command::bwr(RegisterAddress::DcTimePort0.into())
.send_receive(&client, 0u32)
.send_receive(client, 0u32)
.await?
.wkc(num_slaves_with_dc as u16, "Broadcast time")?;

Expand Down Expand Up @@ -432,7 +432,7 @@ pub(crate) async fn run_dc_static_sync(
dc_reference_slave.configured_address,
RegisterAddress::DcSystemTime.into(),
)
.receive::<u64>(&client)
.receive::<u64>(client)
.await?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pdu_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ macro_rules! impl_pdudata {
#[allow(trivial_casts)]
core::slice::from_raw_parts(
self as *const _ as *const u8,
core::mem::size_of::<$ty>(),
(<$ty>::BITS / 8) as usize,
)
}

Expand Down
1 change: 0 additions & 1 deletion src/slave/eeprom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ impl<'a, S> SlaveRef<'a, S> {
DefaultMailbox::parse(&buf)
}

#[allow(unused)]
pub(crate) async fn eeprom_general(&self) -> Result<SiiGeneral, Error> {
let mut reader = EepromSectionReader::new(&self.client, CategoryType::General)
.await?
Expand Down
6 changes: 3 additions & 3 deletions src/slave/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ where
// If flag is set, read entire mailbox to clear it
if sm.status.mailbox_full {
Command::fprd(self.state.configured_address, read_mailbox.address)
.receive_slice(&self.client.client, read_mailbox.len)
.receive_slice(self.client.client, read_mailbox.len)
.await?;
}
}
Expand Down Expand Up @@ -333,7 +333,7 @@ where

// Read acknowledgement from slave OUT mailbox
let response = Command::fprd(self.state.configured_address, read_mailbox.address)
.receive_slice(&self.client.client, read_mailbox.len)
.receive_slice(self.client.client, read_mailbox.len)
.await?
.wkc(1, "read OUT mailbox after write")?;

Expand All @@ -359,7 +359,7 @@ where
// Send data to slave IN mailbox
Command::fpwr(self.state.configured_address, write_mailbox.address)
.send_receive_slice_len(
&self.client.client,
self.client.client,
fmt::unwrap!(request
.pack()
.map_err(crate::error::WrappedPackingError::from))
Expand Down
12 changes: 6 additions & 6 deletions src/slave/slave_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl<'client> SlaveClient<'client> {
T: PduRead,
{
Command::fprd(self.configured_address, register)
.receive(&self.client)
.receive(self.client)
.await
}

Expand All @@ -46,7 +46,7 @@ impl<'client> SlaveClient<'client> {
T: PduData,
{
Command::fpwr(self.configured_address, register)
.send_receive(&self.client, value)
.send_receive(self.client, value)
.await
}

Expand All @@ -56,7 +56,7 @@ impl<'client> SlaveClient<'client> {
T: PduRead,
{
Command::fprd(self.configured_address, register)
.receive(&self.client)
.receive(self.client)
.await?
.wkc(1, context)
}
Expand All @@ -69,7 +69,7 @@ impl<'client> SlaveClient<'client> {
context: &'static str,
) -> Result<RxFrameDataBuf<'_>, Error> {
Command::fprd(self.configured_address, register)
.receive_slice(&self.client, len)
.receive_slice(self.client, len)
.await?
.wkc(1, context)
}
Expand All @@ -82,7 +82,7 @@ impl<'client> SlaveClient<'client> {
context: &'static str,
) -> Result<RxFrameDataBuf<'_>, Error> {
Command::fpwr(self.configured_address, register)
.send_receive_slice(&self.client, value)
.send_receive_slice(self.client, value)
.await?
.wkc(1, context)
}
Expand All @@ -99,7 +99,7 @@ impl<'client> SlaveClient<'client> {
T: PduData,
{
Command::fpwr(self.configured_address, register)
.send(&self.client, value)
.send(self.client, value)
.await?
.wkc(1, context)
}
Expand Down