Skip to content

Commit

Permalink
Fix new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
newAM committed Nov 29, 2024
1 parent 6a375c6 commit 1da9aec
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dhcp/src/pkt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ impl<'a, W: Registers> From<UdpReader<'a, W>> for PktDe<'a, W> {
}
}

impl<'a, W: Registers> PktDe<'a, W> {
impl<W: Registers> PktDe<'_, W> {
#[allow(clippy::wrong_self_convention)]
pub fn is_bootreply(&mut self) -> Result<bool, Error<W::Error>> {
self.reader.seek(SeekFrom::Start(0))?;
Expand Down
4 changes: 2 additions & 2 deletions dns/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub struct Response<'a, W5500: Udp> {
rr_idx: u16,
}

impl<'a, W5500: Udp> Response<'a, W5500> {
impl<W5500: Udp> Response<'_, W5500> {
/// Response code from the server.
///
/// This will return `Err(u8)` if the server uses a reserved value.
Expand Down Expand Up @@ -381,7 +381,7 @@ struct Query<'a, W5500: Udp> {
header: Header,
}

impl<'a, W5500: Udp> Query<'a, W5500> {
impl<W5500: Udp> Query<'_, W5500> {
/// Add a question to the query.
///
/// # References
Expand Down
4 changes: 2 additions & 2 deletions fuzz/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ impl<'a> From<&'a [u8]> for W5500<'a> {
}
}

impl<'a> W5500<'a> {
impl W5500<'_> {
pub fn set_socket_status(&mut self, socket_status: SocketStatus) {
self.socket_status = socket_status
}
}

impl<'a> Registers for W5500<'a> {
impl Registers for W5500<'_> {
type Error = ();

#[inline]
Expand Down
8 changes: 4 additions & 4 deletions hl/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct TcpReader<'w, W5500> {
pub(crate) ptr: u16,
}

impl<'w, W5500> Seek for TcpReader<'w, W5500> {
impl<W5500> Seek for TcpReader<'_, W5500> {
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>> {
self.ptr = pos.new_ptr(self.ptr, self.head_ptr, self.tail_ptr)?;
Ok(())
Expand All @@ -89,7 +89,7 @@ impl<'w, W5500> Seek for TcpReader<'w, W5500> {
}
}

impl<'a, W5500: Registers> Read<W5500::Error> for TcpReader<'a, W5500> {
impl<W5500: Registers> Read<W5500::Error> for TcpReader<'_, W5500> {
fn read(&mut self, buf: &mut [u8]) -> Result<u16, W5500::Error> {
let read_size: u16 = min(self.remain(), buf.len().try_into().unwrap_or(u16::MAX));
if read_size != 0 {
Expand Down Expand Up @@ -166,7 +166,7 @@ pub struct TcpWriter<'w, W5500> {
pub(crate) ptr: u16,
}

impl<'w, W5500> Seek for TcpWriter<'w, W5500> {
impl<W5500> Seek for TcpWriter<'_, W5500> {
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>> {
self.ptr = pos.new_ptr(self.ptr, self.head_ptr, self.tail_ptr)?;
Ok(())
Expand All @@ -189,7 +189,7 @@ impl<'w, W5500> Seek for TcpWriter<'w, W5500> {
}
}

impl<'w, W5500: Registers> Write<W5500::Error> for TcpWriter<'w, W5500> {
impl<W5500: Registers> Write<W5500::Error> for TcpWriter<'_, W5500> {
fn write(&mut self, buf: &[u8]) -> Result<u16, W5500::Error> {
let write_size: u16 = min(self.remain(), buf.len().try_into().unwrap_or(u16::MAX));
if write_size != 0 {
Expand Down
12 changes: 6 additions & 6 deletions hl/src/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub struct UdpReader<'w, W5500> {
header: UdpHeader,
}

impl<'w, W5500> Seek for UdpReader<'w, W5500> {
impl<W5500> Seek for UdpReader<'_, W5500> {
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>> {
self.inner.seek(pos)
}
Expand All @@ -105,7 +105,7 @@ impl<'w, W5500> Seek for UdpReader<'w, W5500> {
}
}

impl<'w, W5500: Registers> Read<W5500::Error> for UdpReader<'w, W5500> {
impl<W5500: Registers> Read<W5500::Error> for UdpReader<'_, W5500> {
fn read(&mut self, buf: &mut [u8]) -> Result<u16, W5500::Error> {
self.inner.read(buf)
}
Expand Down Expand Up @@ -170,7 +170,7 @@ pub struct UdpWriter<'w, W5500> {
pub(crate) ptr: u16,
}

impl<'w, W5500> Seek for UdpWriter<'w, W5500> {
impl<W5500> Seek for UdpWriter<'_, W5500> {
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), Error<E>> {
self.ptr = pos.new_ptr(self.ptr, self.head_ptr, self.tail_ptr)?;
Ok(())
Expand All @@ -193,7 +193,7 @@ impl<'w, W5500> Seek for UdpWriter<'w, W5500> {
}
}

impl<'w, W5500: Registers> Write<W5500::Error> for UdpWriter<'w, W5500> {
impl<W5500: Registers> Write<W5500::Error> for UdpWriter<'_, W5500> {
fn write(&mut self, buf: &[u8]) -> Result<u16, W5500::Error> {
let write_size: u16 = min(self.remain(), buf.len().try_into().unwrap_or(u16::MAX));
if write_size != 0 {
Expand Down Expand Up @@ -226,7 +226,7 @@ impl<'w, W5500: Registers> Write<W5500::Error> for UdpWriter<'w, W5500> {
}
}

impl<'w, W5500: Registers> UdpWriter<'w, W5500> {
impl<W5500: Registers> UdpWriter<'_, W5500> {
/// Send all data previously written with [`UdpWriter::write`] and
/// [`UdpWriter::write_all`] to the given address.
///
Expand All @@ -240,7 +240,7 @@ impl<'w, W5500: Registers> UdpWriter<'w, W5500> {
}
}

impl<'a, W: Registers> UdpReader<'a, W> {
impl<W: Registers> UdpReader<'_, W> {
/// Get the UDP header.
///
/// # Example
Expand Down
2 changes: 1 addition & 1 deletion tls/src/handshake/client_hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ struct ClientHelloWriter<'a> {
key_schedule: &'a mut KeySchedule,
}

impl<'a> ClientHelloWriter<'a> {
impl ClientHelloWriter<'_> {
pub fn copy_from_slice(&mut self, src: &[u8]) {
self.copy_from_slice_no_hash(src);
self.key_schedule.update_transcript_hash(src);
Expand Down
8 changes: 4 additions & 4 deletions tls/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub struct TlsWriter<'w, 'ks, W5500: Registers> {
pub(crate) ptr: u16,
}

impl<'w, 'ks, W5500: Registers> Seek for TlsWriter<'w, 'ks, W5500> {
impl<W5500: Registers> Seek for TlsWriter<'_, '_, W5500> {
fn seek<E>(&mut self, pos: SeekFrom) -> Result<(), HlError<E>> {
self.ptr = pos.new_ptr(self.ptr, self.head_ptr, self.tail_ptr)?;
Ok(())
Expand All @@ -208,7 +208,7 @@ impl<'w, 'ks, W5500: Registers> Seek for TlsWriter<'w, 'ks, W5500> {
}
}

impl<'w, 'ks, W5500: Registers> Write<W5500::Error> for TlsWriter<'w, 'ks, W5500> {
impl<W5500: Registers> Write<W5500::Error> for TlsWriter<'_, '_, W5500> {
fn write(&mut self, buf: &[u8]) -> Result<u16, W5500::Error> {
let write_size: u16 = min(self.remain(), buf.len().try_into().unwrap_or(u16::MAX));
if write_size != 0 {
Expand Down Expand Up @@ -312,7 +312,7 @@ pub struct TlsReader<'buf, 'ptr> {
wrap: usize,
}

impl<'buf, 'ptr> Seek for TlsReader<'buf, 'ptr> {
impl Seek for TlsReader<'_, '_> {
fn seek<Infallible>(&mut self, pos: SeekFrom) -> Result<(), HlError<Infallible>> {
match pos {
SeekFrom::Start(n) => {
Expand Down Expand Up @@ -377,7 +377,7 @@ impl<'buf, 'ptr> Seek for TlsReader<'buf, 'ptr> {
}
}

impl<'buf, 'ptr> Read<Infallible> for TlsReader<'buf, 'ptr> {
impl Read<Infallible> for TlsReader<'_, '_> {
fn read(&mut self, buf: &mut [u8]) -> Result<u16, Infallible> {
Ok(self.inner.read(buf))
}
Expand Down

0 comments on commit 1da9aec

Please sign in to comment.