Skip to content

Commit

Permalink
Small fixes courtesy of clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
honzasp committed Feb 9, 2023
1 parent 92754ba commit a18b9c0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/codec/packet_decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl PacketDecode {
/// Decode a `mpint` as a scalar in unsigned big endian with given length.
pub fn get_scalar(&mut self, len: usize) -> Result<Vec<u8>> {
let mut bytes = self.get_bytes()?;
while bytes.get(0) == Some(&0) {
while bytes.first() == Some(&0) {
bytes.advance(1);
}

Expand Down
2 changes: 1 addition & 1 deletion src/codec/send_pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl SendPipe {

pub fn feed_packet(&mut self, payload: &[u8]) -> u32 {
log::trace!("feed packet {}, len {}, seq {}",
payload.get(0).cloned().unwrap_or(0), payload.len(), self.packet_seq);
payload.first().cloned().unwrap_or(0), payload.len(), self.packet_seq);

let include_len = match self.encrypt {
PacketEncrypt::EncryptAndMac(_, _) => true,
Expand Down
4 changes: 2 additions & 2 deletions src/host_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl File {
/// Comments and invalid lines are not returned by this method.
pub fn entries(&self) -> impl Iterator<Item = &Entry> {
self.lines.iter().filter_map(|line| match &line.content {
LineContent::Entry(entry) => Some(&*entry as &Entry),
LineContent::Entry(entry) => Some(entry as &Entry),
LineContent::Comment | LineContent::Error(_) => None,
})
}
Expand Down Expand Up @@ -596,7 +596,7 @@ fn read_field<'b>(bytes: &mut &'b [u8]) -> Option<&'b [u8]> {
consume_whitespace(bytes);

// '#' starts a comment, which should be ignored
if matches!(bytes.get(0), None | Some(b'#')) {
if matches!(bytes.first(), None | Some(b'#')) {
return None
}

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![allow(clippy::unused_unit)]
#![allow(clippy::unit_arg)]
#![allow(clippy::module_inception)]
#![allow(clippy::type_complexity)]
#![warn(missing_docs)]

pub use crate::client::{
Expand Down

0 comments on commit a18b9c0

Please sign in to comment.