Skip to content

Commit a0f122b

Browse files
committed
fix clippy warnings
1 parent 28bc322 commit a0f122b

File tree

42 files changed

+73
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+73
-84
lines changed

sqlx-cli/src/database.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unexpected_cfgs)]
12
use crate::migrate;
23
use crate::opt::ConnectOpts;
34
use console::{style, Term};

sqlx-cli/src/opt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unexpected_cfgs)]
12
use std::ops::{Deref, Not};
23

34
use clap::{Args, Parser};

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/connection/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,5 @@ pub trait AnyConnectionBackend: std::any::Any + Debug + Send + 'static {
115115
parameters: &[AnyTypeInfo],
116116
) -> BoxFuture<'c, crate::Result<AnyStatement>>;
117117

118-
fn describe<'q>(&'q mut self, sql: SqlStr) -> BoxFuture<'q, crate::Result<Describe<Any>>>;
118+
fn describe(&mut self, sql: SqlStr) -> BoxFuture<'_, crate::Result<Describe<Any>>>;
119119
}

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl Statement for AnyStatement {
5555
impl_statement_query!(AnyArguments<'_>);
5656
}
5757

58-
impl<'i> ColumnIndex<AnyStatement> for &'i str {
58+
impl ColumnIndex<AnyStatement> for &'_ str {
5959
fn index(&self, statement: &AnyStatement) -> Result<usize, Error> {
6060
statement
6161
.column_names
@@ -65,7 +65,7 @@ impl<'i> ColumnIndex<AnyStatement> for &'i str {
6565
}
6666
}
6767

68-
impl<'q> AnyStatement {
68+
impl AnyStatement {
6969
#[doc(hidden)]
7070
pub fn try_from_statement<S>(
7171
statement: S,

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/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/pool/inner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,14 @@ pub(super) fn is_beyond_max_lifetime<DB: Database>(
452452
) -> bool {
453453
options
454454
.max_lifetime
455-
.map_or(false, |max| live.created_at.elapsed() > max)
455+
.is_some_and(|max| live.created_at.elapsed() > max)
456456
}
457457

458458
/// Returns `true` if the connection has exceeded `options.idle_timeout` if set, `false` otherwise.
459459
fn is_beyond_idle_timeout<DB: Database>(idle: &Idle<DB>, options: &PoolOptions<DB>) -> bool {
460460
options
461461
.idle_timeout
462-
.map_or(false, |timeout| idle.idle_since.elapsed() > timeout)
462+
.is_some_and(|timeout| idle.idle_since.elapsed() > timeout)
463463
}
464464

465465
async fn check_idle_conn<DB: Database>(

0 commit comments

Comments
 (0)