Skip to content

Commit

Permalink
fix: clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pv42 committed Aug 22, 2024
1 parent 44ebf42 commit 3e7c4a7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mavlink-core/src/connection/direct_serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ impl<M: Message> MavConnection<M> for SerialConnection {

#[cfg(feature = "signing")]
fn setup_signing(&mut self, signing_data: Option<SigningConfig>) {
self.signing_data = signing_data.map(|cfg| SigningData::from_config(cfg))
self.signing_data = signing_data.map(SigningData::from_config)
}
}
2 changes: 1 addition & 1 deletion mavlink-core/src/connection/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ impl<M: Message> MavConnection<M> for FileConnection {

#[cfg(feature = "signing")]
fn setup_signing(&mut self, signing_data: Option<SigningConfig>) {
self.signing_data = signing_data.map(|cfg| SigningData::from_config(cfg))
self.signing_data = signing_data.map(SigningData::from_config)
}
}
2 changes: 1 addition & 1 deletion mavlink-core/src/connection/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ impl<M: Message> MavConnection<M> for TcpConnection {

#[cfg(feature = "signing")]
fn setup_signing(&mut self, signing_data: Option<SigningConfig>) {
self.signing_data = signing_data.map(|cfg| SigningData::from_config(cfg))
self.signing_data = signing_data.map(SigningData::from_config)
}
}
2 changes: 1 addition & 1 deletion mavlink-core/src/connection/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl<M: Message> MavConnection<M> for UdpConnection {

#[cfg(feature = "signing")]
fn setup_signing(&mut self, signing_data: Option<SigningConfig>) {
self.signing_data = signing_data.map(|cfg| SigningData::from_config(cfg))
self.signing_data = signing_data.map(SigningData::from_config)
}
}

Expand Down
8 changes: 4 additions & 4 deletions mavlink-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,11 +716,11 @@ impl MAVLinkV2MessageRaw {
pub fn calculate_signature(&self, secret_key: &[u8], target_buffer: &mut [u8; 6]) {
let mut hasher = Sha256::new();
hasher.update(secret_key);
hasher.update(&[MAV_STX_V2]);
hasher.update([MAV_STX_V2]);
hasher.update(self.header());
hasher.update(self.payload());
hasher.update(self.checksum_bytes());
hasher.update(&[self.signature_link_id()]);
hasher.update([self.signature_link_id()]);
hasher.update(self.signature_timestamp_bytes());
target_buffer.copy_from_slice(&hasher.finalize()[0..6]);
}
Expand Down Expand Up @@ -878,13 +878,13 @@ fn read_v2_raw_message_inner<M: Message, R: Read>(
}

/// Async read a raw buffer with the mavlink message
///
///
/// V2 maximum size is 280 bytes: `<https://mavlink.io/en/guide/serialization.html>`
#[cfg(feature = "tokio-1")]
pub async fn read_v2_raw_message_async<M: Message, R: tokio::io::AsyncReadExt + Unpin>(
reader: &mut R,
) -> Result<MAVLinkV2MessageRaw, error::MessageReadError> {
read_v2_raw_message_async_inner::<M,R>(reader, None).await
read_v2_raw_message_async_inner::<M, R>(reader, None).await
}

/// Async read a raw buffer with the mavlink message
Expand Down
2 changes: 1 addition & 1 deletion mavlink/tests/tcp_loopback_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod test_tcp_connections {

#[cfg(feature = "signing")]
use mavlink::SigningConfig;

#[cfg(feature = "signing")]
use crate::test_shared;

/// Test whether we can send a message via TCP and receive it OK. This also test signing as a property of a MavConnection if the signing feature is enabled.
Expand Down

0 comments on commit 3e7c4a7

Please sign in to comment.