Skip to content

Commit

Permalink
Fix new lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Icelk committed Dec 29, 2024
1 parent 99affd4 commit 4fb2e12
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/cors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ pub enum MethodAllowList<'a> {
/// Only the methods in the slice are allowed.
Selected(&'a [Method]),
}
impl<'a> MethodAllowList<'a> {
impl MethodAllowList<'_> {
#[must_use]
fn allowed(&self, method: &Method) -> bool {
match self {
Expand Down
10 changes: 5 additions & 5 deletions src/encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ mod tokio_tls {
cx: &'a mut Context<'b>,
}

impl<'a, 'b, T: AsyncRead + Unpin> Read for Reader<'a, 'b, T> {
impl<T: AsyncRead + Unpin> Read for Reader<'_, '_, T> {
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
let mut buf = ReadBuf::new(buf);
Expand Down Expand Up @@ -453,7 +453,7 @@ mod tokio_tls {
cx: &'a mut Context<'b>,
}

impl<'a, 'b, T: Unpin> Writer<'a, 'b, T> {
impl<T: Unpin> Writer<'_, '_, T> {
#[inline]
fn poll_with<U>(
&mut self,
Expand All @@ -466,7 +466,7 @@ mod tokio_tls {
}
}

impl<'a, 'b, T: AsyncWrite + Unpin> Write for Writer<'a, 'b, T> {
impl<T: AsyncWrite + Unpin> Write for Writer<'_, '_, T> {
#[inline]
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.poll_with(|io, cx| io.poll_write(cx, buf))
Expand Down Expand Up @@ -552,7 +552,7 @@ mod tokio_tls {
}
}

impl<'a, IO: AsyncRead + AsyncWrite + Unpin, C, SD> AsyncRead for Stream<'a, IO, C>
impl<IO: AsyncRead + AsyncWrite + Unpin, C, SD> AsyncRead for Stream<'_, IO, C>
where
C: DerefMut + Deref<Target = ConnectionCommon<SD>>,
SD: SideData,
Expand Down Expand Up @@ -612,7 +612,7 @@ mod tokio_tls {
}
}

impl<'a, IO: AsyncRead + AsyncWrite + Unpin, C, SD> AsyncWrite for Stream<'a, IO, C>
impl<IO: AsyncRead + AsyncWrite + Unpin, C, SD> AsyncWrite for Stream<'_, IO, C>
where
C: DerefMut + Deref<Target = ConnectionCommon<SD>>,
SD: SideData,
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
clippy::unused_self,
// When a enum variant has been conditionally compiled away.
irrefutable_let_patterns,
// I know what I'm doing. I use this to have references to options which are in structs.
// .as_ref would work but it's ugly and I want consistent types with these things.
clippy::ref_option
)]
#![doc(html_favicon_url = "https://kvarn.org/favicon.svg")]
#![doc(html_logo_url = "https://kvarn.org/logo.svg")]
Expand Down Expand Up @@ -1959,7 +1962,7 @@ impl Debug for FatResponse {
Str(&'a str),
Bytes,
}
impl<'a> Debug for BytesOrStr<'a> {
impl Debug for BytesOrStr<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Self::Str(s) => f.write_str(s),
Expand Down
2 changes: 2 additions & 0 deletions src/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl Manager {
let shutdown = self.shutdown.load(Ordering::Acquire);
if shutdown {
debug!("There are no connections. Shutting down.");
#[allow(clippy::used_underscore_items)] // cfg
self._shutdown();
}
}
Expand Down Expand Up @@ -272,6 +273,7 @@ impl Manager {
}

if self.connections.load(Ordering::Acquire) <= 0 {
#[allow(clippy::used_underscore_items)] // cfg
self._shutdown();
}
debug!(
Expand Down
4 changes: 2 additions & 2 deletions src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pub enum WSStream<'a> {
/// so this is unlikely to get more versions
Http1(&'a Arc<Mutex<Encryption>>),
}
impl<'a> AsyncRead for WSStream<'a> {
impl AsyncRead for WSStream<'_> {
fn poll_read(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand All @@ -144,7 +144,7 @@ impl<'a> AsyncRead for WSStream<'a> {
}
}
}
impl<'a> AsyncWrite for WSStream<'a> {
impl AsyncWrite for WSStream<'_> {
fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
Expand Down
2 changes: 1 addition & 1 deletion utils/src/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl<'a> Iterator for PresentArgumentsIter<'a> {
Some(unsafe { str::from_utf8_unchecked(&self.data.data[start..start + len]) })
}
}
impl<'a> DoubleEndedIterator for PresentArgumentsIter<'a> {
impl DoubleEndedIterator for PresentArgumentsIter<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
if self.index == self.back_index {
Expand Down
7 changes: 4 additions & 3 deletions utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ macro_rules! ident_str {
($item:ident $(, $($name:ident)+, $($generics:tt)+)?) => {{
// we use this to make rust-analyzer realize $name is
// an item. This means IDE renaming is also applied on $var.
#[allow(non_local_definitions)]
impl$(<$($generics)+>)? $item$(<$($name)+>)? {}
stringify!($item)
}};
Expand Down Expand Up @@ -298,13 +299,13 @@ impl<'a, T: ?Sized + Display> CleanDebug<'a, T> {
Self(value)
}
}
impl<'a, T: ?Sized + Display> Debug for CleanDebug<'a, T> {
impl<T: ?Sized + Display> Debug for CleanDebug<'_, T> {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
Display::fmt(self.0, f)
}
}
impl<'a, T: ?Sized + Display> Display for CleanDebug<'a, T> {
impl<T: ?Sized + Display> Display for CleanDebug<'_, T> {
#[inline]
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
Display::fmt(self.0, f)
Expand Down Expand Up @@ -740,7 +741,7 @@ pub struct QuotedStrSplitIter<'a> {
current: String,
escaped: usize,
}
impl<'a> Iterator for QuotedStrSplitIter<'a> {
impl Iterator for QuotedStrSplitIter<'_> {
type Item = String;
fn next(&mut self) -> Option<Self::Item> {
loop {
Expand Down
6 changes: 3 additions & 3 deletions utils/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ impl<'a> QueryPair<'a> {
&self.value
}
}
impl<'a> Display for QueryPair<'a> {
impl Display for QueryPair<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str(self.name())?;
f.write_str("=")?;
Expand Down Expand Up @@ -496,7 +496,7 @@ impl<'a> Query<'a> {
Ok(self.iterate_to_first(name, index))
}
}
impl<'a> Display for Query<'a> {
impl Display for Query<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
for (pos, pair) in self.pairs.iter().enumerate() {
f.write_fmt(format_args!("{}", pair))?;
Expand Down Expand Up @@ -566,7 +566,7 @@ impl<'a> Iterator for QueryPairIter<'a> {
})
}
}
impl<'a> DoubleEndedIterator for QueryPairIter<'a> {
impl DoubleEndedIterator for QueryPairIter<'_> {
fn next_back(&mut self) -> Option<Self::Item> {
self.ensure_back_pos();
if self.pos == Some(self.back_pos.unwrap()) {
Expand Down

0 comments on commit 4fb2e12

Please sign in to comment.