Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cargo +nightly clippy --fix #2006

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion quinn-proto/src/connection/datagrams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Datagrams<'a> {
pub(super) conn: &'a mut Connection,
}

impl<'a> Datagrams<'a> {
impl Datagrams<'_> {
/// Queue an unreliable, unordered datagram for immediate transmission
///
/// If `drop` is true, previously queued datagrams which are still unsent may be discarded to
Expand Down
4 changes: 3 additions & 1 deletion quinn-proto/src/connection/streams/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub struct Streams<'a> {
pub(super) conn_state: &'a super::State,
}

#[allow(clippy::needless_lifetimes)] // Needed for cfg(fuzzing)
impl<'a> Streams<'a> {
#[cfg(fuzzing)]
pub fn new(state: &'a mut StreamsState, conn_state: &'a super::State) -> Self {
Expand Down Expand Up @@ -105,7 +106,7 @@ pub struct RecvStream<'a> {
pub(super) pending: &'a mut Retransmits,
}

impl<'a> RecvStream<'a> {
impl RecvStream<'_> {
/// Read from the given recv stream
///
/// `max_length` limits the maximum size of the returned `Bytes` value; passing `usize::MAX`
Expand Down Expand Up @@ -196,6 +197,7 @@ pub struct SendStream<'a> {
pub(super) conn_state: &'a super::State,
}

#[allow(clippy::needless_lifetimes)] // Needed for cfg(fuzzing)
impl<'a> SendStream<'a> {
#[cfg(fuzzing)]
pub fn new(
Expand Down
2 changes: 1 addition & 1 deletion quinn-proto/src/connection/streams/recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl<'a> Chunks<'a> {
}
}

impl<'a> Drop for Chunks<'a> {
impl Drop for Chunks<'_> {
fn drop(&mut self) {
let _ = self.finalize_inner();
}
Expand Down
4 changes: 2 additions & 2 deletions quinn-proto/src/connection/streams/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl<'a> BytesArray<'a> {
}
}

impl<'a> BytesSource for BytesArray<'a> {
impl BytesSource for BytesArray<'_> {
fn pop_chunk(&mut self, limit: usize) -> (Bytes, usize) {
// The loop exists to skip empty chunks while still marking them as
// consumed
Expand Down Expand Up @@ -208,7 +208,7 @@ impl<'a> ByteSlice<'a> {
}
}

impl<'a> BytesSource for ByteSlice<'a> {
impl BytesSource for ByteSlice<'_> {
fn pop_chunk(&mut self, limit: usize) -> (Bytes, usize) {
let limit = limit.min(self.data.len());
if limit == 0 {
Expand Down
2 changes: 1 addition & 1 deletion quinn-proto/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ impl<'a> AckIter<'a> {
}
}

impl<'a> Iterator for AckIter<'a> {
impl Iterator for AckIter<'_> {
type Item = RangeInclusive<u64>;
fn next(&mut self) -> Option<RangeInclusive<u64>> {
if !self.data.has_remaining() {
Expand Down
8 changes: 4 additions & 4 deletions quinn-proto/src/range_set/btree_range_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ impl RangeSet {

pub struct Iter<'a>(btree_map::Iter<'a, u64, u64>);

impl<'a> Iterator for Iter<'a> {
impl Iterator for Iter<'_> {
type Item = Range<u64>;
fn next(&mut self) -> Option<Range<u64>> {
let (&start, &end) = self.0.next()?;
Some(start..end)
}
}

impl<'a> DoubleEndedIterator for Iter<'a> {
impl DoubleEndedIterator for Iter<'_> {
fn next_back(&mut self) -> Option<Range<u64>> {
let (&start, &end) = self.0.next_back()?;
Some(start..end)
Expand All @@ -241,7 +241,7 @@ pub struct EltIter<'a> {
end: u64,
}

impl<'a> Iterator for EltIter<'a> {
impl Iterator for EltIter<'_> {
type Item = u64;
fn next(&mut self) -> Option<u64> {
if self.next == self.end {
Expand All @@ -255,7 +255,7 @@ impl<'a> Iterator for EltIter<'a> {
}
}

impl<'a> DoubleEndedIterator for EltIter<'a> {
impl DoubleEndedIterator for EltIter<'_> {
fn next_back(&mut self) -> Option<u64> {
if self.next == self.end {
let (&start, &end) = self.inner.next_back()?;
Expand Down
2 changes: 1 addition & 1 deletion quinn-udp/src/cmsg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<'a, M: MsgHdr> Encoder<'a, M> {

// Statically guarantees that the encoding operation is "finished" before the control buffer is read
// by `sendmsg` like API.
impl<'a, M: MsgHdr> Drop for Encoder<'a, M> {
impl<M: MsgHdr> Drop for Encoder<'_, M> {
fn drop(&mut self) {
self.hdr.set_control_len(self.len as _);
}
Expand Down
2 changes: 1 addition & 1 deletion quinn/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ pin_project! {
}
}

impl<'a> Future for Accept<'a> {
impl Future for Accept<'_> {
type Output = Option<Incoming>;
fn poll(self: Pin<&mut Self>, ctx: &mut Context<'_>) -> Poll<Self::Output> {
let mut this = self.project();
Expand Down
4 changes: 2 additions & 2 deletions quinn/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ mod non_tracking {
guard: std::sync::MutexGuard<'a, T>,
}

impl<'a, T> Deref for MutexGuard<'a, T> {
impl<T> Deref for MutexGuard<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
self.guard.deref()
}
}

impl<'a, T> DerefMut for MutexGuard<'a, T> {
impl<T> DerefMut for MutexGuard<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.guard.deref_mut()
}
Expand Down
8 changes: 4 additions & 4 deletions quinn/src/recv_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ struct Read<'a> {
buf: ReadBuf<'a>,
}

impl<'a> Future for Read<'a> {
impl Future for Read<'_> {
type Output = Result<Option<usize>, ReadError>;

fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
Expand All @@ -625,7 +625,7 @@ struct ReadExact<'a> {
buf: ReadBuf<'a>,
}

impl<'a> Future for ReadExact<'a> {
impl Future for ReadExact<'_> {
type Output = Result<(), ReadExactError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand Down Expand Up @@ -663,7 +663,7 @@ struct ReadChunk<'a> {
ordered: bool,
}

impl<'a> Future for ReadChunk<'a> {
impl Future for ReadChunk<'_> {
type Output = Result<Option<Chunk>, ReadError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let (max_length, ordered) = (self.max_length, self.ordered);
Expand All @@ -680,7 +680,7 @@ struct ReadChunks<'a> {
bufs: &'a mut [Bytes],
}

impl<'a> Future for ReadChunks<'a> {
impl Future for ReadChunks<'_> {
type Output = Result<Option<usize>, ReadError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand Down
10 changes: 5 additions & 5 deletions quinn/src/send_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ struct Write<'a> {
buf: &'a [u8],
}

impl<'a> Future for Write<'a> {
impl Future for Write<'_> {
type Output = Result<usize, WriteError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand All @@ -345,7 +345,7 @@ struct WriteAll<'a> {
buf: &'a [u8],
}

impl<'a> Future for WriteAll<'a> {
impl Future for WriteAll<'_> {
type Output = Result<(), WriteError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand All @@ -369,7 +369,7 @@ struct WriteChunks<'a> {
bufs: &'a mut [Bytes],
}

impl<'a> Future for WriteChunks<'a> {
impl Future for WriteChunks<'_> {
type Output = Result<Written, WriteError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand All @@ -387,7 +387,7 @@ struct WriteChunk<'a> {
buf: [Bytes; 1],
}

impl<'a> Future for WriteChunk<'a> {
impl Future for WriteChunk<'_> {
type Output = Result<(), WriteError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand All @@ -411,7 +411,7 @@ struct WriteAllChunks<'a> {
offset: usize,
}

impl<'a> Future for WriteAllChunks<'a> {
impl Future for WriteAllChunks<'_> {
type Output = Result<(), WriteError>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let this = self.get_mut();
Expand Down