Skip to content

Commit

Permalink
build: address clippy issues from 1.83 (#2393)
Browse files Browse the repository at this point in the history
  • Loading branch information
camshaft authored Dec 3, 2024
1 parent 3743cdf commit 06a004d
Show file tree
Hide file tree
Showing 104 changed files with 191 additions and 191 deletions.
2 changes: 1 addition & 1 deletion common/s2n-codec/src/encoder/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl<'a> EncoderBuffer<'a> {
}
}

impl<'a> Encoder for EncoderBuffer<'a> {
impl Encoder for EncoderBuffer<'_> {
#[inline]
fn write_sized<F: FnOnce(&mut [u8])>(&mut self, len: usize, write: F) {
self.assert_capacity(len);
Expand Down
2 changes: 1 addition & 1 deletion common/s2n-codec/src/encoder/scatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<'a> Buffer<'a> {
fn flush(&mut self) {}
}

impl<'a> Encoder for Buffer<'a> {
impl Encoder for Buffer<'_> {
/// We have special handling for writes that include `Bytes` so signal that
#[cfg(feature = "bytes")]
const SPECIALIZES_BYTES: bool = true;
Expand Down
1 change: 1 addition & 0 deletions dc/s2n-quic-dc/src/event/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// This file was generated with the `s2n-quic-events` crate and any required
// changes should be made there.

#![allow(clippy::needless_lifetimes)]
use super::*;
pub(crate) mod metrics;
pub mod api {
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/msg/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ impl<'a> Iterator for Drain<'a> {
}
}

impl<'a> Drop for Drain<'a> {
impl Drop for Drain<'_> {
#[inline]
fn drop(&mut self) {
self.message.force_clear();
Expand Down
4 changes: 2 additions & 2 deletions dc/s2n-quic-dc/src/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub enum Packet<'a> {
UnknownPathSecret(secret_control::unknown_path_secret::Packet<'a>),
}

impl<'a> Packet<'a> {
impl Packet<'_> {
#[inline]
pub fn kind(&self) -> Kind {
match self {
Expand All @@ -61,7 +61,7 @@ impl<'a> s2n_codec::DecoderParameterizedValueMut<'a> for Packet<'a> {
fn decode_parameterized_mut(
tag_len: Self::Parameter,
decoder: DecoderBufferMut<'a>,
) -> s2n_codec::DecoderBufferMutResult<Self> {
) -> s2n_codec::DecoderBufferMutResult<'a, Self> {
match decoder.peek().decode().map(|(tag, _)| tag)? {
Tag::Control(_) => {
let (packet, decoder) = control::decoder::Packet::decode(decoder, (), tag_len)?;
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/packet/control/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct Packet<'a> {
auth_tag: &'a mut [u8],
}

impl<'a> Packet<'a> {
impl Packet<'_> {
#[inline]
pub fn tag(&self) -> Tag {
self.tag
Expand Down
4 changes: 2 additions & 2 deletions dc/s2n-quic-dc/src/packet/datagram/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct Packet<'a> {
auth_tag: &'a mut [u8],
}

impl<'a> std::fmt::Debug for Packet<'a> {
impl std::fmt::Debug for Packet<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("Packet")
.field("tag", &self.tag)
Expand All @@ -79,7 +79,7 @@ impl<'a> std::fmt::Debug for Packet<'a> {
}
}

impl<'a> Packet<'a> {
impl Packet<'_> {
#[inline]
pub fn tag(&self) -> Tag {
self.tag
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/packet/secret_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub enum Packet<'a> {

impl<'a> Packet<'a> {
#[inline]
pub fn decode(buffer: DecoderBufferMut<'a>) -> Rm<Self> {
pub fn decode(buffer: DecoderBufferMut<'a>) -> Rm<'a, Self> {
let tag = buffer.peek_byte(0)?;

Ok(match tag {
Expand Down
7 changes: 5 additions & 2 deletions dc/s2n-quic-dc/src/packet/secret_control/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ macro_rules! impl_packet {

impl<'a> Packet<'a> {
#[inline]
pub fn decode(buffer: DecoderBufferMut<'a>) -> Rm<Packet> {
pub fn decode(buffer: DecoderBufferMut<'a>) -> Rm<'a, Self> {
let header_len = decoder::header_len::<$name>(buffer.peek())?;
let ((header, value, crypto_tag), buffer) = decoder::header(buffer, header_len)?;
let packet = Self {
Expand Down Expand Up @@ -62,7 +62,10 @@ where
}

#[inline]
pub fn header<'a, T>(buffer: DecoderBufferMut<'a>, header_len: usize) -> Rm<'a, (&[u8], T, &[u8])>
pub fn header<'a, T>(
buffer: DecoderBufferMut<'a>,
header_len: usize,
) -> Rm<'a, (&'a [u8], T, &'a [u8])>
where
T: DecoderValue<'a>,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> Packet<'a> {
}

#[inline]
pub fn decode(buffer: DecoderBufferMut<'a>) -> Rm<Packet> {
pub fn decode(buffer: DecoderBufferMut<'a>) -> Rm<'a, Self> {
let header_len = decoder::header_len::<UnknownPathSecret>(buffer.peek())?;
let ((header, value, crypto_tag), buffer) = decoder::header(buffer, header_len)?;
let packet = Self {
Expand Down
4 changes: 2 additions & 2 deletions dc/s2n-quic-dc/src/packet/stream/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub struct Packet<'a> {
auth_tag: &'a mut [u8],
}

impl<'a> fmt::Debug for Packet<'a> {
impl fmt::Debug for Packet<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("stream::Packet")
.field("tag", &self.tag)
Expand All @@ -134,7 +134,7 @@ impl<'a> fmt::Debug for Packet<'a> {
}
}

impl<'a> Packet<'a> {
impl Packet<'_> {
#[inline]
pub fn tag(&self) -> Tag {
self.tag
Expand Down
4 changes: 2 additions & 2 deletions dc/s2n-quic-dc/src/path/secret/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct SharedSlotGuard<'a> {
key_id: u64,
}

impl<'a> SharedSlotGuard<'a> {
impl SharedSlotGuard<'_> {
fn write_id(&mut self, id: Id) {
// Store the new ID.
// SAFETY: We hold the lock since we are in the guard.
Expand All @@ -109,7 +109,7 @@ impl<'a> SharedSlotGuard<'a> {
}
}

impl<'a> Drop for SharedSlotGuard<'a> {
impl Drop for SharedSlotGuard<'_> {
fn drop(&mut self) {
self.slot.key_id.store(self.key_id, Ordering::Release);
}
Expand Down
4 changes: 2 additions & 2 deletions dc/s2n-quic-dc/src/stream/recv/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ where
pub receiver: &'a mut Receiver,
}

impl<'a, 'p, D, K, C: Clock> reader::Storage for Packet<'a, 'p, D, K, C>
impl<D, K, C: Clock> reader::Storage for Packet<'_, '_, D, K, C>
where
D: crypto::open::Application,
K: crypto::open::control::Stream,
Expand Down Expand Up @@ -114,7 +114,7 @@ where
}
}

impl<'a, 'p, D, K, C: Clock> Reader for Packet<'a, 'p, D, K, C>
impl<D, K, C: Clock> Reader for Packet<'_, '_, D, K, C>
where
D: crypto::open::Application,
K: crypto::open::control::Stream,
Expand Down
8 changes: 4 additions & 4 deletions dc/s2n-quic-dc/src/stream/recv/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ where
initial_state: state::Receiver,
}

impl<'a, Sub> AppGuard<'a, Sub>
impl<Sub> AppGuard<'_, Sub>
where
Sub: event::Subscriber,
{
Expand Down Expand Up @@ -223,7 +223,7 @@ where
}
}

impl<'a, Sub> ops::Deref for AppGuard<'a, Sub>
impl<Sub> ops::Deref for AppGuard<'_, Sub>
where
Sub: event::Subscriber,
{
Expand All @@ -235,7 +235,7 @@ where
}
}

impl<'a, Sub> ops::DerefMut for AppGuard<'a, Sub>
impl<Sub> ops::DerefMut for AppGuard<'_, Sub>
where
Sub: event::Subscriber,
{
Expand All @@ -245,7 +245,7 @@ where
}
}

impl<'a, Sub> Drop for AppGuard<'a, Sub>
impl<Sub> Drop for AppGuard<'_, Sub>
where
Sub: event::Subscriber,
{
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/stream/send/application/transmission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct Drain<'a, Buffer> {
queue: &'a Queue<Buffer>,
}

impl<'a, Buffer> Iterator for Drain<'a, Buffer> {
impl<Buffer> Iterator for Drain<'_, Buffer> {
type Item = Event<Buffer>;

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/stream/send/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct Message<'a> {
segment_alloc: &'a buffer::Allocator,
}

impl<'a> application::state::Message for Message<'a> {
impl application::state::Message for Message<'_> {
#[inline]
fn max_segments(&self) -> usize {
self.max_segments
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/stream/socket/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub struct ExtRecvBuffer<'a, T: Socket + ?Sized> {
msg: &'a mut msg::recv::Message,
}

impl<'a, T: Socket> core::future::Future for ExtRecvBuffer<'a, T> {
impl<T: Socket> core::future::Future for ExtRecvBuffer<'_, T> {
type Output = io::Result<usize>;

fn poll(mut self: core::pin::Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
Expand Down
2 changes: 1 addition & 1 deletion dc/s2n-quic-dc/src/sync/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ pin_project! {
}
}

impl<'a, T> EventListenerFuture for RecvInner<'a, T> {
impl<T> EventListenerFuture for RecvInner<'_, T> {
type Output = Result<T, Closed>;

/// Run this future with the given `Strategy`.
Expand Down
2 changes: 1 addition & 1 deletion quic/s2n-quic-bench/src/xdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct Message {
payload_len: usize,
}

impl<'a> tx::Message for &'a Message {
impl tx::Message for &Message {
type Handle = path::Tuple;

fn path_handle(&self) -> &Self::Handle {
Expand Down
2 changes: 1 addition & 1 deletion quic/s2n-quic-core/src/application/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl From<Error> for u64 {
}
}

impl<'a> From<Error> for ConnectionClose<'a> {
impl From<Error> for ConnectionClose<'_> {
fn from(error: Error) -> Self {
ConnectionClose {
error_code: error.0,
Expand Down
6 changes: 3 additions & 3 deletions quic/s2n-quic-core/src/buffer/duplex/interposer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ where
}

/// Delegates to the inner Duplex
impl<'a, S, D> reader::Storage for Interposer<'a, S, D>
impl<S, D> reader::Storage for Interposer<'_, S, D>
where
S: writer::Storage + ?Sized,
D: duplex::Skip<Error = Infallible> + ?Sized,
Expand Down Expand Up @@ -86,7 +86,7 @@ where
}

/// Delegates to the inner Duplex
impl<'a, C, D> Reader for Interposer<'a, C, D>
impl<C, D> Reader for Interposer<'_, C, D>
where
C: writer::Storage + ?Sized,
D: duplex::Skip<Error = Infallible> + ?Sized,
Expand All @@ -112,7 +112,7 @@ where
}
}

impl<'a, C, D> Writer for Interposer<'a, C, D>
impl<C, D> Writer for Interposer<'_, C, D>
where
C: writer::Storage + ?Sized,
D: duplex::Skip<Error = Infallible> + ?Sized,
Expand Down
4 changes: 2 additions & 2 deletions quic/s2n-quic-core/src/buffer/reader/checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ where
}

#[cfg(debug_assertions)]
impl<'a, R> Storage for Checked<'a, R>
impl<R> Storage for Checked<'_, R>
where
R: Reader + ?Sized,
{
Expand Down Expand Up @@ -149,7 +149,7 @@ where
}
}

impl<'a, R> Reader for Checked<'a, R>
impl<R> Reader for Checked<'_, R>
where
R: Reader + ?Sized,
{
Expand Down
4 changes: 2 additions & 2 deletions quic/s2n-quic-core/src/buffer/reader/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
}
}

impl<'a, S> Storage for Complete<'a, S>
impl<S> Storage for Complete<'_, S>
where
S: Storage,
{
Expand Down Expand Up @@ -83,7 +83,7 @@ where
}
}

impl<'a, C> Reader for Complete<'a, C>
impl<C> Reader for Complete<'_, C>
where
C: Storage,
{
Expand Down
4 changes: 2 additions & 2 deletions quic/s2n-quic-core/src/buffer/reader/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a, R: Reader + ?Sized> Empty<'a, R> {
}
}

impl<'a, R: Reader + ?Sized> Storage for Empty<'a, R> {
impl<R: Reader + ?Sized> Storage for Empty<'_, R> {
type Error = core::convert::Infallible;

#[inline(always)]
Expand All @@ -42,7 +42,7 @@ impl<'a, R: Reader + ?Sized> Storage for Empty<'a, R> {
}
}

impl<'a, R: Reader + ?Sized> Reader for Empty<'a, R> {
impl<R: Reader + ?Sized> Reader for Empty<'_, R> {
#[inline]
fn current_offset(&self) -> VarInt {
self.0.current_offset()
Expand Down
6 changes: 3 additions & 3 deletions quic/s2n-quic-core/src/buffer/reader/incremental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub struct WithStorage<'a, C: Storage> {
storage: &'a mut C,
}

impl<'a, C: Storage> WithStorage<'a, C> {
impl<C: Storage> WithStorage<'_, C> {
#[inline]
pub fn set_fin(&mut self) -> Result<&mut Self, Error> {
let final_offset = self
Expand All @@ -88,7 +88,7 @@ impl<'a, C: Storage> WithStorage<'a, C> {
}
}

impl<'a, C: Storage> Storage for WithStorage<'a, C> {
impl<C: Storage> Storage for WithStorage<'_, C> {
type Error = C::Error;

#[inline]
Expand Down Expand Up @@ -127,7 +127,7 @@ impl<'a, C: Storage> Storage for WithStorage<'a, C> {
}
}

impl<'a, C: Storage> Reader for WithStorage<'a, C> {
impl<C: Storage> Reader for WithStorage<'_, C> {
#[inline]
fn current_offset(&self) -> VarInt {
self.incremental.current_offset()
Expand Down
4 changes: 2 additions & 2 deletions quic/s2n-quic-core/src/buffer/reader/limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<'a, R: Reader + ?Sized> Limit<'a, R> {
}
}

impl<'a, R: Reader + ?Sized> Storage for Limit<'a, R> {
impl<R: Reader + ?Sized> Storage for Limit<'_, R> {
type Error = R::Error;

#[inline]
Expand Down Expand Up @@ -78,7 +78,7 @@ impl<'a, R: Reader + ?Sized> Storage for Limit<'a, R> {
}
}

impl<'a, R: Reader + ?Sized> Reader for Limit<'a, R> {
impl<R: Reader + ?Sized> Reader for Limit<'_, R> {
#[inline]
fn current_offset(&self) -> VarInt {
self.reader.current_offset()
Expand Down
Loading

0 comments on commit 06a004d

Please sign in to comment.