Skip to content

Commit 1f21e79

Browse files
conradludgatearpad-m
authored andcommitted
fix newly introduced clippy lints
1 parent 3c7a7a9 commit 1f21e79

File tree

14 files changed

+119
-48
lines changed

14 files changed

+119
-48
lines changed

Cargo.lock

+83-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

postgres-protocol/src/message/backend.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ pub struct ColumnFormats<'a> {
591591
remaining: u16,
592592
}
593593

594-
impl<'a> FallibleIterator for ColumnFormats<'a> {
594+
impl FallibleIterator for ColumnFormats<'_> {
595595
type Item = u16;
596596
type Error = io::Error;
597597

@@ -695,7 +695,7 @@ pub struct DataRowRanges<'a> {
695695
remaining: u16,
696696
}
697697

698-
impl<'a> FallibleIterator for DataRowRanges<'a> {
698+
impl FallibleIterator for DataRowRanges<'_> {
699699
type Item = Option<Range<usize>>;
700700
type Error = io::Error;
701701

@@ -783,7 +783,7 @@ pub struct ErrorField<'a> {
783783
value: &'a str,
784784
}
785785

786-
impl<'a> ErrorField<'a> {
786+
impl ErrorField<'_> {
787787
#[inline]
788788
pub fn type_(&self) -> u8 {
789789
self.type_
@@ -849,7 +849,7 @@ pub struct Parameters<'a> {
849849
remaining: u16,
850850
}
851851

852-
impl<'a> FallibleIterator for Parameters<'a> {
852+
impl FallibleIterator for Parameters<'_> {
853853
type Item = Oid;
854854
type Error = io::Error;
855855

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/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ keywords = ["database", "postgres", "postgresql", "sql"]
1111
categories = ["database"]
1212

1313
[features]
14+
default = ["with-chrono-0_4"]
1415
derive = ["postgres-derive"]
1516
array-impls = ["array-init"]
1617
with-bit-vec-0_6 = ["bit-vec-06"]

postgres-types/src/chrono_04.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn base() -> NaiveDateTime {
1414
.unwrap()
1515
}
1616

17-
impl<'a> FromSql<'a> for NaiveDateTime {
17+
impl FromSql<'_> for NaiveDateTime {
1818
fn from_sql(_: &Type, raw: &[u8]) -> Result<NaiveDateTime, Box<dyn Error + Sync + Send>> {
1919
let t = types::timestamp_from_sql(raw)?;
2020
base()
@@ -39,7 +39,7 @@ impl ToSql for NaiveDateTime {
3939
to_sql_checked!();
4040
}
4141

42-
impl<'a> FromSql<'a> for DateTime<Utc> {
42+
impl FromSql<'_> for DateTime<Utc> {
4343
fn from_sql(type_: &Type, raw: &[u8]) -> Result<DateTime<Utc>, Box<dyn Error + Sync + Send>> {
4444
let naive = NaiveDateTime::from_sql(type_, raw)?;
4545
Ok(Utc.from_utc_datetime(&naive))
@@ -61,7 +61,7 @@ impl ToSql for DateTime<Utc> {
6161
to_sql_checked!();
6262
}
6363

64-
impl<'a> FromSql<'a> for DateTime<Local> {
64+
impl FromSql<'_> for DateTime<Local> {
6565
fn from_sql(type_: &Type, raw: &[u8]) -> Result<DateTime<Local>, Box<dyn Error + Sync + Send>> {
6666
let utc = DateTime::<Utc>::from_sql(type_, raw)?;
6767
Ok(utc.with_timezone(&Local))
@@ -83,7 +83,7 @@ impl ToSql for DateTime<Local> {
8383
to_sql_checked!();
8484
}
8585

86-
impl<'a> FromSql<'a> for DateTime<FixedOffset> {
86+
impl FromSql<'_> for DateTime<FixedOffset> {
8787
fn from_sql(
8888
type_: &Type,
8989
raw: &[u8],
@@ -108,7 +108,7 @@ impl ToSql for DateTime<FixedOffset> {
108108
to_sql_checked!();
109109
}
110110

111-
impl<'a> FromSql<'a> for NaiveDate {
111+
impl FromSql<'_> for NaiveDate {
112112
fn from_sql(_: &Type, raw: &[u8]) -> Result<NaiveDate, Box<dyn Error + Sync + Send>> {
113113
let jd = types::date_from_sql(raw)?;
114114
base()
@@ -123,7 +123,7 @@ impl<'a> FromSql<'a> for NaiveDate {
123123
impl ToSql for NaiveDate {
124124
fn to_sql(&self, _: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
125125
let jd = self.signed_duration_since(base().date()).num_days();
126-
if jd > i64::from(i32::max_value()) || jd < i64::from(i32::min_value()) {
126+
if jd > i64::from(i32::MAX) || jd < i64::from(i32::MIN) {
127127
return Err("value too large to transmit".into());
128128
}
129129

@@ -135,7 +135,7 @@ impl ToSql for NaiveDate {
135135
to_sql_checked!();
136136
}
137137

138-
impl<'a> FromSql<'a> for NaiveTime {
138+
impl FromSql<'_> for NaiveTime {
139139
fn from_sql(_: &Type, raw: &[u8]) -> Result<NaiveTime, Box<dyn Error + Sync + Send>> {
140140
let usec = types::time_from_sql(raw)?;
141141
Ok(NaiveTime::from_hms_opt(0, 0, 0).unwrap() + Duration::microseconds(usec))

postgres-types/src/lib.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ pub enum Format {
908908
Binary,
909909
}
910910

911-
impl<'a, T> ToSql for &'a T
911+
impl<T> ToSql for &T
912912
where
913913
T: ToSql,
914914
{
@@ -957,7 +957,7 @@ impl<T: ToSql> ToSql for Option<T> {
957957
to_sql_checked!();
958958
}
959959

960-
impl<'a, T: ToSql> ToSql for &'a [T] {
960+
impl<T: ToSql> ToSql for &[T] {
961961
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
962962
let member_type = match *ty.kind() {
963963
Kind::Array(ref member) => member,
@@ -998,7 +998,7 @@ impl<'a, T: ToSql> ToSql for &'a [T] {
998998
to_sql_checked!();
999999
}
10001000

1001-
impl<'a> ToSql for &'a [u8] {
1001+
impl ToSql for &[u8] {
10021002
fn to_sql(&self, _: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
10031003
types::bytea_to_sql(self, w);
10041004
Ok(IsNull::No)
@@ -1058,7 +1058,7 @@ impl<T: ToSql> ToSql for Box<[T]> {
10581058
to_sql_checked!();
10591059
}
10601060

1061-
impl<'a> ToSql for Cow<'a, [u8]> {
1061+
impl ToSql for Cow<'_, [u8]> {
10621062
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
10631063
<&[u8] as ToSql>::to_sql(&self.as_ref(), ty, w)
10641064
}
@@ -1082,7 +1082,7 @@ impl ToSql for Vec<u8> {
10821082
to_sql_checked!();
10831083
}
10841084

1085-
impl<'a> ToSql for &'a str {
1085+
impl ToSql for &str {
10861086
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
10871087
match ty.name() {
10881088
"ltree" => types::ltree_to_sql(self, w),
@@ -1103,7 +1103,7 @@ impl<'a> ToSql for &'a str {
11031103
to_sql_checked!();
11041104
}
11051105

1106-
impl<'a> ToSql for Cow<'a, str> {
1106+
impl ToSql for Cow<'_, str> {
11071107
fn to_sql(&self, ty: &Type, w: &mut BytesMut) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
11081108
<&str as ToSql>::to_sql(&self.as_ref(), ty, w)
11091109
}
@@ -1250,17 +1250,17 @@ impl BorrowToSql for &dyn ToSql {
12501250
}
12511251
}
12521252

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

1255-
impl<'a> BorrowToSql for Box<dyn ToSql + Sync + 'a> {
1255+
impl BorrowToSql for Box<dyn ToSql + Sync + '_> {
12561256
#[inline]
12571257
fn borrow_to_sql(&self) -> &dyn ToSql {
12581258
self.as_ref()
12591259
}
12601260
}
12611261

1262-
impl<'a> sealed::Sealed for Box<dyn ToSql + Sync + Send + 'a> {}
1263-
impl<'a> BorrowToSql for Box<dyn ToSql + Sync + Send + 'a> {
1262+
impl sealed::Sealed for Box<dyn ToSql + Sync + Send + '_> {}
1263+
impl BorrowToSql for Box<dyn ToSql + Sync + Send + '_> {
12641264
#[inline]
12651265
fn borrow_to_sql(&self) -> &dyn ToSql {
12661266
self.as_ref()

0 commit comments

Comments
 (0)