Skip to content

Commit 720ffe8

Browse files
committed
fix clippy
1 parent 14a1216 commit 720ffe8

File tree

12 files changed

+30
-30
lines changed

12 files changed

+30
-30
lines changed

postgres-protocol/src/message/backend.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ pub struct ColumnFormats<'a> {
475475
remaining: u16,
476476
}
477477

478-
impl<'a> FallibleIterator for ColumnFormats<'a> {
478+
impl FallibleIterator for ColumnFormats<'_> {
479479
type Item = u16;
480480
type Error = io::Error;
481481

@@ -557,7 +557,7 @@ pub struct DataRowRanges<'a> {
557557
remaining: u16,
558558
}
559559

560-
impl<'a> FallibleIterator for DataRowRanges<'a> {
560+
impl FallibleIterator for DataRowRanges<'_> {
561561
type Item = Option<Range<usize>>;
562562
type Error = io::Error;
563563

@@ -645,7 +645,7 @@ pub struct ErrorField<'a> {
645645
value: &'a [u8],
646646
}
647647

648-
impl<'a> ErrorField<'a> {
648+
impl ErrorField<'_> {
649649
#[inline]
650650
pub fn type_(&self) -> u8 {
651651
self.type_
@@ -717,7 +717,7 @@ pub struct Parameters<'a> {
717717
remaining: u16,
718718
}
719719

720-
impl<'a> FallibleIterator for Parameters<'a> {
720+
impl FallibleIterator for Parameters<'_> {
721721
type Item = Oid;
722722
type Error = io::Error;
723723

postgres-protocol/src/types/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl<'a> Array<'a> {
582582
/// An iterator over the dimensions of an array.
583583
pub struct ArrayDimensions<'a>(&'a [u8]);
584584

585-
impl<'a> FallibleIterator for ArrayDimensions<'a> {
585+
impl FallibleIterator for ArrayDimensions<'_> {
586586
type Item = ArrayDimension;
587587
type Error = StdBox<dyn Error + Sync + Send>;
588588

@@ -950,7 +950,7 @@ pub struct PathPoints<'a> {
950950
buf: &'a [u8],
951951
}
952952

953-
impl<'a> FallibleIterator for PathPoints<'a> {
953+
impl FallibleIterator for PathPoints<'_> {
954954
type Item = Point;
955955
type Error = StdBox<dyn Error + Sync + Send>;
956956

postgres-types/src/lib.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ pub enum Format {
914914
Binary,
915915
}
916916

917-
impl<'a, T> ToSql for &'a T
917+
impl<T> ToSql for &T
918918
where
919919
T: ToSql,
920920
{
@@ -963,7 +963,7 @@ impl<T: ToSql> ToSql for Option<T> {
963963
to_sql_checked!();
964964
}
965965

966-
impl<'a, T: ToSql> ToSql for &'a [T] {
966+
impl<T: ToSql> ToSql for &[T] {
967967
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
968968
let member_type = match *ty.kind() {
969969
Kind::Array(ref member) => member,
@@ -1004,7 +1004,7 @@ impl<'a, T: ToSql> ToSql for &'a [T] {
10041004
to_sql_checked!();
10051005
}
10061006

1007-
impl<'a> ToSql for &'a [u8] {
1007+
impl ToSql for &[u8] {
10081008
fn to_sql(&self, _: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
10091009
types::bytea_to_sql(self, w);
10101010
Ok(IsNull::No)
@@ -1064,7 +1064,7 @@ impl<T: ToSql> ToSql for Box<[T]> {
10641064
to_sql_checked!();
10651065
}
10661066

1067-
impl<'a> ToSql for Cow<'a, [u8]> {
1067+
impl ToSql for Cow<'_, [u8]> {
10681068
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
10691069
<&[u8] as ToSql>::to_sql(&self.as_ref(), ty, w)
10701070
}
@@ -1088,7 +1088,7 @@ impl ToSql for Vec<u8> {
10881088
to_sql_checked!();
10891089
}
10901090

1091-
impl<'a> ToSql for &'a str {
1091+
impl ToSql for &str {
10921092
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
10931093
match ty.name() {
10941094
"ltree" => types::ltree_to_sql(self, w),
@@ -1109,7 +1109,7 @@ impl<'a> ToSql for &'a str {
11091109
to_sql_checked!();
11101110
}
11111111

1112-
impl<'a> ToSql for Cow<'a, str> {
1112+
impl ToSql for Cow<'_, str> {
11131113
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
11141114
<&str as ToSql>::to_sql(&self.as_ref(), ty, w)
11151115
}
@@ -1256,17 +1256,17 @@ impl BorrowToSql for &dyn ToSql {
12561256
}
12571257
}
12581258

1259-
impl<'a> sealed::Sealed for Box<dyn ToSql + Sync + 'a> {}
1259+
impl sealed::Sealed for Box<dyn ToSql + Sync + '_> {}
12601260

1261-
impl<'a> BorrowToSql for Box<dyn ToSql + Sync + 'a> {
1261+
impl BorrowToSql for Box<dyn ToSql + Sync + '_> {
12621262
#[inline]
12631263
fn borrow_to_sql(&self) -> &dyn ToSql {
12641264
self.as_ref()
12651265
}
12661266
}
12671267

1268-
impl<'a> sealed::Sealed for Box<dyn ToSql + Sync + Send + 'a> {}
1269-
impl<'a> BorrowToSql for Box<dyn ToSql + Sync + Send + 'a> {
1268+
impl sealed::Sealed for Box<dyn ToSql + Sync + Send + '_> {}
1269+
impl BorrowToSql for Box<dyn ToSql + Sync + Send + '_> {
12701270
#[inline]
12711271
fn borrow_to_sql(&self) -> &dyn ToSql {
12721272
self.as_ref()

postgres/src/notifications.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub struct Iter<'a> {
7777
connection: ConnectionRef<'a>,
7878
}
7979

80-
impl<'a> FallibleIterator for Iter<'a> {
80+
impl FallibleIterator for Iter<'_> {
8181
type Item = Notification;
8282
type Error = Error;
8383

@@ -100,7 +100,7 @@ pub struct BlockingIter<'a> {
100100
connection: ConnectionRef<'a>,
101101
}
102102

103-
impl<'a> FallibleIterator for BlockingIter<'a> {
103+
impl FallibleIterator for BlockingIter<'_> {
104104
type Item = Notification;
105105
type Error = Error;
106106

@@ -129,7 +129,7 @@ pub struct TimeoutIter<'a> {
129129
timeout: Duration,
130130
}
131131

132-
impl<'a> FallibleIterator for TimeoutIter<'a> {
132+
impl FallibleIterator for TimeoutIter<'_> {
133133
type Item = Notification;
134134
type Error = Error;
135135

postgres/src/transaction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub struct Transaction<'a> {
1212
transaction: Option<tokio_postgres::Transaction<'a>>,
1313
}
1414

15-
impl<'a> Drop for Transaction<'a> {
15+
impl Drop for Transaction<'_> {
1616
fn drop(&mut self) {
1717
if let Some(transaction) = self.transaction.take() {
1818
let _ = self.connection.block_on(transaction.rollback());

tokio-postgres/src/generic_client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub trait GenericClient: private::Sealed {
8080
) -> Result<Statement, Error>;
8181

8282
/// Like [`Client::transaction`].
83-
async fn transaction(&mut self) -> Result<Transaction<'_>, Error>;
83+
async fn transaction<'a>(&'a mut self) -> Result<Transaction<'a>, Error>;
8484

8585
/// Like [`Client::batch_execute`].
8686
async fn batch_execute(&self, query: &str) -> Result<(), Error>;
@@ -180,7 +180,7 @@ impl GenericClient for Client {
180180
self.prepare_typed(query, parameter_types).await
181181
}
182182

183-
async fn transaction(&mut self) -> Result<Transaction<'_>, Error> {
183+
async fn transaction<'a>(&'a mut self) -> Result<Transaction<'a>, Error> {
184184
self.transaction().await
185185
}
186186

tokio-postgres/src/query.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::task::{Context, Poll};
2020

2121
struct BorrowToSqlParamsDebug<'a, T>(&'a [T]);
2222

23-
impl<'a, T> fmt::Debug for BorrowToSqlParamsDebug<'a, T>
23+
impl<T> fmt::Debug for BorrowToSqlParamsDebug<'_, T>
2424
where
2525
T: BorrowToSql,
2626
{
@@ -61,7 +61,7 @@ where
6161
})
6262
}
6363

64-
pub async fn query_typed<'a, P, I>(
64+
pub async fn query_typed<P, I>(
6565
client: &Arc<InnerClient>,
6666
query: &str,
6767
params: I,

tokio-postgres/src/row.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ impl RowIndex for str {
7979
}
8080
}
8181

82-
impl<'a, T> Sealed for &'a T where T: ?Sized + Sealed {}
82+
impl<T> Sealed for &T where T: ?Sized + Sealed {}
8383

84-
impl<'a, T> RowIndex for &'a T
84+
impl<T> RowIndex for &T
8585
where
8686
T: ?Sized + RowIndex,
8787
{

tokio-postgres/src/to_statement.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod private {
1111
Query(&'a str),
1212
}
1313

14-
impl<'a> ToStatementType<'a> {
14+
impl ToStatementType<'_> {
1515
pub async fn into_statement(self, client: &Client) -> Result<Statement, Error> {
1616
match self {
1717
ToStatementType::Statement(s) => Ok(s.clone()),

tokio-postgres/src/transaction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct Savepoint {
3333
depth: u32,
3434
}
3535

36-
impl<'a> Drop for Transaction<'a> {
36+
impl Drop for Transaction<'_> {
3737
fn drop(&mut self) {
3838
if self.done {
3939
return;

tokio-postgres/src/transaction_builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'a> TransactionBuilder<'a> {
113113
done: bool,
114114
}
115115

116-
impl<'a> Drop for RollbackIfNotDone<'a> {
116+
impl Drop for RollbackIfNotDone<'_> {
117117
fn drop(&mut self) {
118118
if self.done {
119119
return;

tokio-postgres/tests/test/types/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ async fn domain() {
509509
to_sql_checked!();
510510
}
511511

512-
impl<'a> FromSql<'a> for SessionId {
512+
impl FromSql<'_> for SessionId {
513513
fn from_sql(ty: &Type, raw: &[u8]) -> result::Result<Self, Box<dyn Error + Sync + Send>> {
514514
Vec::<u8>::from_sql(ty, raw).map(SessionId)
515515
}

0 commit comments

Comments
 (0)