Skip to content

Commit da41c4e

Browse files
committed
fix: lots more Clippy warnings
1 parent 531cf7a commit da41c4e

File tree

18 files changed

+31
-34
lines changed

18 files changed

+31
-34
lines changed

sqlx-core/src/any/arguments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'q> Arguments<'q> for AnyArguments<'q> {
3232

3333
pub struct AnyArgumentBuffer<'q>(#[doc(hidden)] pub Vec<AnyValueKind<'q>>);
3434

35-
impl<'q> Default for AnyArguments<'q> {
35+
impl Default for AnyArguments<'_> {
3636
fn default() -> Self {
3737
AnyArguments {
3838
values: AnyArgumentBuffer(vec![]),

sqlx-core/src/any/row.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl Row for AnyRow {
6363
}
6464
}
6565

66-
impl<'i> ColumnIndex<AnyRow> for &'i str {
66+
impl ColumnIndex<AnyRow> for &'_ str {
6767
fn index(&self, row: &AnyRow) -> Result<usize, Error> {
6868
row.column_names
6969
.get(*self)

sqlx-core/src/any/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'q> Statement<'q> for AnyStatement<'q> {
5151
impl_statement_query!(AnyArguments<'_>);
5252
}
5353

54-
impl<'i> ColumnIndex<AnyStatement<'_>> for &'i str {
54+
impl ColumnIndex<AnyStatement<'_>> for &'_ str {
5555
fn index(&self, statement: &AnyStatement<'_>) -> Result<usize, Error> {
5656
statement
5757
.column_names

sqlx-core/src/ext/async_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<T> Yielder<T> {
9595
}
9696
}
9797

98-
impl<'a, T> Stream for TryAsyncStream<'a, T> {
98+
impl<T> Stream for TryAsyncStream<'_, T> {
9999
type Item = Result<T, Error>;
100100

101101
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {

sqlx-core/src/io/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub trait ProtocolEncode<'en, Context = ()> {
99
fn encode_with(&self, buf: &mut Vec<u8>, context: Context) -> Result<(), crate::Error>;
1010
}
1111

12-
impl<'en, C> ProtocolEncode<'en, C> for &'_ [u8] {
12+
impl<C> ProtocolEncode<'_, C> for &'_ [u8] {
1313
fn encode_with(&self, buf: &mut Vec<u8>, _context: C) -> Result<(), crate::Error> {
1414
buf.extend_from_slice(self);
1515
Ok(())

sqlx-core/src/logger.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<'q> QueryLogger<'q> {
158158
}
159159
}
160160

161-
impl<'q> Drop for QueryLogger<'q> {
161+
impl Drop for QueryLogger<'_> {
162162
fn drop(&mut self) {
163163
self.finish();
164164
}

sqlx-core/src/net/socket/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub struct Read<'a, S: ?Sized, B> {
6262
buf: &'a mut B,
6363
}
6464

65-
impl<'a, S: ?Sized, B> Future for Read<'a, S, B>
65+
impl<S: ?Sized, B> Future for Read<'_, S, B>
6666
where
6767
S: Socket,
6868
B: ReadBuf,
@@ -90,7 +90,7 @@ pub struct Write<'a, S: ?Sized> {
9090
buf: &'a [u8],
9191
}
9292

93-
impl<'a, S: ?Sized> Future for Write<'a, S>
93+
impl<S: ?Sized> Future for Write<'_, S>
9494
where
9595
S: Socket,
9696
{
@@ -116,7 +116,7 @@ pub struct Flush<'a, S: ?Sized> {
116116
socket: &'a mut S,
117117
}
118118

119-
impl<'a, S: Socket + ?Sized> Future for Flush<'a, S> {
119+
impl<S: Socket + ?Sized> Future for Flush<'_, S> {
120120
type Output = io::Result<()>;
121121

122122
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
@@ -128,7 +128,7 @@ pub struct Shutdown<'a, S: ?Sized> {
128128
socket: &'a mut S,
129129
}
130130

131-
impl<'a, S: ?Sized> Future for Shutdown<'a, S>
131+
impl<S: ?Sized> Future for Shutdown<'_, S>
132132
where
133133
S: Socket,
134134
{

sqlx-core/src/net/tls/tls_rustls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ where
138138
}
139139
} else {
140140
#[cfg(any(feature = "_tls-rustls-aws-lc-rs", feature = "_tls-rustls-ring-webpki"))]
141-
let mut cert_store = certs_from_webpki();
141+
let cert_store = certs_from_webpki();
142142
#[cfg(feature = "_tls-rustls-ring-native-roots")]
143143
let mut cert_store = certs_from_native_store();
144144

@@ -225,7 +225,7 @@ fn certs_from_native_store() -> RootCertStore {
225225
log::warn!("Error loading native certificates: {e:?}");
226226
}
227227
for cert in load_results.certs {
228-
if let Err(e) = root_cert_store.add(cert.into()) {
228+
if let Err(e) = root_cert_store.add(cert) {
229229
log::warn!("rustls failed to parse native certificate: {e:?}");
230230
}
231231
}

sqlx-core/src/pool/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::error::Error;
99
use crate::executor::{Execute, Executor};
1010
use crate::pool::Pool;
1111

12-
impl<'p, DB: Database> Executor<'p> for &'_ Pool<DB>
12+
impl<DB: Database> Executor<'_> for &'_ Pool<DB>
1313
where
1414
for<'c> &'c mut DB::Connection: Executor<'c, Database = DB>,
1515
{

sqlx-core/src/pool/inner.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,13 @@ pub(super) fn is_beyond_max_lifetime<DB: Database>(
451451
options: &PoolOptions<DB>,
452452
) -> bool {
453453
options
454-
.max_lifetime
455-
.map_or(false, |max| live.created_at.elapsed() > max)
454+
.max_lifetime.is_some_and(|max| live.created_at.elapsed() > max)
456455
}
457456

458457
/// Returns `true` if the connection has exceeded `options.idle_timeout` if set, `false` otherwise.
459458
fn is_beyond_idle_timeout<DB: Database>(idle: &Idle<DB>, options: &PoolOptions<DB>) -> bool {
460459
options
461-
.idle_timeout
462-
.map_or(false, |timeout| idle.idle_since.elapsed() > timeout)
460+
.idle_timeout.is_some_and(|timeout| idle.idle_since.elapsed() > timeout)
463461
}
464462

465463
async fn check_idle_conn<DB: Database>(

0 commit comments

Comments
 (0)