Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty19106 committed Nov 30, 2022
1 parent f1db6d1 commit b539218
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<M: Message> MavFrame<M> {
let mut payload_buf = [0u8; 255];
let payload_len = self.msg.ser(self.protocol_version, &mut payload_buf);

v.extend_from_slice(&mut payload_buf[..payload_len])
v.extend_from_slice(&payload_buf[..payload_len])
.unwrap();

v
Expand All @@ -186,7 +186,7 @@ impl<M: Message> MavFrame<M> {
};

match M::parse(version, msg_id, buf.remaining_bytes()) {
Ok(msg) => Ok(MavFrame {
Ok(msg) => Ok(Self {
header,
msg,
protocol_version: version,
Expand Down Expand Up @@ -230,12 +230,12 @@ impl MAVLinkV1MessageRaw {

#[inline]
pub fn header(&mut self) -> &[u8] {
&self.0[1..(1 + Self::HEADER_SIZE)]
&self.0[1..=Self::HEADER_SIZE]
}

#[inline]
fn mut_header(&mut self) -> &mut [u8] {
&mut self.0[1..(1 + Self::HEADER_SIZE)]
&mut self.0[1..=Self::HEADER_SIZE]
}

#[inline]
Expand Down Expand Up @@ -336,7 +336,7 @@ pub fn read_v1_raw_message<R: Read>(
let mut message = MAVLinkV1MessageRaw::new();

message.0[0] = MAV_STX;
reader.read_exact(&mut message.mut_header())?;
reader.read_exact(message.mut_header())?;
reader.read_exact(message.mut_payload_and_checksum())?;

Ok(message)
Expand Down Expand Up @@ -393,12 +393,12 @@ impl MAVLinkV2MessageRaw {

#[inline]
pub fn header(&mut self) -> &[u8] {
&self.0[1..(1 + Self::HEADER_SIZE)]
&self.0[1..=Self::HEADER_SIZE]
}

#[inline]
fn mut_header(&mut self) -> &mut [u8] {
&mut self.0[1..(1 + Self::HEADER_SIZE)]
&mut self.0[1..=Self::HEADER_SIZE]
}

#[inline]
Expand Down Expand Up @@ -522,7 +522,7 @@ pub fn read_v2_raw_message<R: Read>(
let mut message = MAVLinkV2MessageRaw::new();

message.0[0] = MAV_STX_V2;
reader.read_exact(&mut message.mut_header())?;
reader.read_exact(message.mut_header())?;
reader.read_exact(message.mut_payload_and_checksum_and_sign())?;

Ok(message)
Expand Down

0 comments on commit b539218

Please sign in to comment.