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 25, 2024
1 parent 51e6de1 commit 552560b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 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 @@ -705,11 +705,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 @@ -917,9 +917,9 @@ async fn read_v2_raw_message_async_inner<M: Message, R: tokio::io::AsyncReadExt
}
}

return Ok(message);
}
return Ok(message);
}
}

/// Async read a raw buffer with the mavlink message with signing support
/// V2 maximum size is 280 bytes: `<https://mavlink.io/en/guide/serialization.html>`
Expand Down

0 comments on commit 552560b

Please sign in to comment.