Skip to content

Commit c0d44e8

Browse files
committed
Merge pull request #4369 from weiznich/bump/rust_1.83.0@origin
Bump rustversion to 1.83 and fix new clippy lints
1 parent ac69bb3 commit c0d44e8

File tree

69 files changed

+300
-214
lines changed

Some content is hidden

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

69 files changed

+300
-214
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
allow:
6+
dependency-type: "direct"
7+
schedule:
8+
interval: "weekly"
9+
reviewers:
10+
- "diesel/reviewer"
11+
versioning-strategy: "widen"

diesel/src/associations/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ pub trait HasTable {
369369
fn table() -> Self::Table;
370370
}
371371

372-
impl<'a, T: HasTable> HasTable for &'a T {
372+
impl<T: HasTable> HasTable for &T {
373373
type Table = T::Table;
374374

375375
fn table() -> Self::Table {

diesel/src/connection/instrumentation.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ impl DebugQuery for StrQueryHelper<'_> {}
6969
/// implementation of the enum itself and any of its fields
7070
/// is not guarantee to be stable.
7171
//
72-
// This types is carefully designed
72+
// This type is carefully designed
7373
// to avoid any potential overhead by
7474
// taking references for all things
7575
// and by not performing any additional
7676
// work until required.
7777
// In addition it's carefully designed
7878
// not to be dependent on the actual backend
79-
// type, as that makes it easier to to reuse
79+
// type, as that makes it easier to reuse
8080
// `Instrumentation` implementations in
81-
// different a different context
81+
// a different context
8282
#[derive(Debug)]
8383
#[non_exhaustive]
8484
pub enum InstrumentationEvent<'a> {
@@ -243,7 +243,7 @@ impl<'a> InstrumentationEvent<'a> {
243243
/// `tracing` and `log` are supposed to be part of their own
244244
/// crates.
245245
pub trait Instrumentation: Send + 'static {
246-
/// The function that is invoced for each event
246+
/// The function that is invoked for each event
247247
fn on_connection_event(&mut self, event: InstrumentationEvent<'_>);
248248
}
249249

@@ -266,9 +266,11 @@ pub fn get_default_instrumentation() -> Option<Box<dyn Instrumentation>> {
266266
///
267267
/// // a simple logger that prints all events to stdout
268268
/// fn simple_logger() -> Option<Box<dyn Instrumentation>> {
269-
/// // we need the explicit argument type there due
270-
/// // to bugs in rustc
271-
/// Some(Box::new(|event: InstrumentationEvent<'_>| println!("{event:?}")))
269+
/// // we need the explicit argument type there due
270+
/// // to bugs in rustc
271+
/// Some(Box::new(|event: InstrumentationEvent<'_>| {
272+
/// println!("{event:?}")
273+
/// }))
272274
/// }
273275
///
274276
/// set_default_instrumentation(simple_logger);

diesel/src/connection/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,9 @@ pub(crate) mod private {
588588
where
589589
T: super::LoadConnection<B>,
590590
{
591-
type Cursor<'conn, 'query> = <T as super::LoadConnection<B>>::Cursor<'conn, 'query> where T: 'conn;
591+
type Cursor<'conn, 'query>
592+
= <T as super::LoadConnection<B>>::Cursor<'conn, 'query>
593+
where
594+
T: 'conn;
592595
}
593596
}

diesel/src/connection/statement_cache.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pub enum MaybeCached<'a, T: 'a> {
294294
Cached(&'a mut T),
295295
}
296296

297-
impl<'a, T> Deref for MaybeCached<'a, T> {
297+
impl<T> Deref for MaybeCached<'_, T> {
298298
type Target = T;
299299

300300
fn deref(&self) -> &Self::Target {
@@ -305,7 +305,7 @@ impl<'a, T> Deref for MaybeCached<'a, T> {
305305
}
306306
}
307307

308-
impl<'a, T> DerefMut for MaybeCached<'a, T> {
308+
impl<T> DerefMut for MaybeCached<'_, T> {
309309
fn deref_mut(&mut self) -> &mut Self::Target {
310310
match *self {
311311
MaybeCached::CannotCache(ref mut x) => x,

diesel/src/expression/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ impl<T: Expression + ?Sized> Expression for Box<T> {
158158
type SqlType = T::SqlType;
159159
}
160160

161-
impl<'a, T: Expression + ?Sized> Expression for &'a T {
161+
impl<T: Expression + ?Sized> Expression for &T {
162162
type SqlType = T::SqlType;
163163
}
164164

@@ -698,7 +698,7 @@ impl<T: ValidGrouping<GB> + ?Sized, GB> ValidGrouping<GB> for Box<T> {
698698
type IsAggregate = T::IsAggregate;
699699
}
700700

701-
impl<'a, T: ValidGrouping<GB> + ?Sized, GB> ValidGrouping<GB> for &'a T {
701+
impl<T: ValidGrouping<GB> + ?Sized, GB> ValidGrouping<GB> for &T {
702702
type IsAggregate = T::IsAggregate;
703703
}
704704

@@ -1027,16 +1027,16 @@ where
10271027
{
10281028
}
10291029

1030-
impl<'a, QS, ST, DB, GB, IsAggregate> QueryId
1031-
for dyn BoxableExpression<QS, DB, GB, IsAggregate, SqlType = ST> + 'a
1030+
impl<QS, ST, DB, GB, IsAggregate> QueryId
1031+
for dyn BoxableExpression<QS, DB, GB, IsAggregate, SqlType = ST> + '_
10321032
{
10331033
type QueryId = ();
10341034

10351035
const HAS_STATIC_QUERY_ID: bool = false;
10361036
}
10371037

1038-
impl<'a, QS, ST, DB, GB, IsAggregate> ValidGrouping<GB>
1039-
for dyn BoxableExpression<QS, DB, GB, IsAggregate, SqlType = ST> + 'a
1038+
impl<QS, ST, DB, GB, IsAggregate> ValidGrouping<GB>
1039+
for dyn BoxableExpression<QS, DB, GB, IsAggregate, SqlType = ST> + '_
10401040
{
10411041
type IsAggregate = IsAggregate;
10421042
}

diesel/src/insertable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub trait CanInsertInSingleQuery<DB: Backend> {
8686
fn rows_to_insert(&self) -> Option<usize>;
8787
}
8888

89-
impl<'a, T, DB> CanInsertInSingleQuery<DB> for &'a T
89+
impl<T, DB> CanInsertInSingleQuery<DB> for &T
9090
where
9191
T: ?Sized + CanInsertInSingleQuery<DB>,
9292
DB: Backend,

diesel/src/migration/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ pub type Result<T> = std::result::Result<T, Box<dyn Error + Send + Sync>>;
2424
#[diesel(sql_type = Text)]
2525
pub struct MigrationVersion<'a>(Cow<'a, str>);
2626

27-
impl<'a> MigrationVersion<'a> {
27+
impl MigrationVersion<'_> {
2828
/// Convert the current migration version into
2929
/// an owned variant with static life time
3030
pub fn as_owned(&self) -> MigrationVersion<'static> {
3131
MigrationVersion(Cow::Owned(self.0.as_ref().to_owned()))
3232
}
3333
}
3434

35-
impl<'a, DB> FromSql<Text, DB> for MigrationVersion<'a>
35+
impl<DB> FromSql<Text, DB> for MigrationVersion<'_>
3636
where
3737
String: FromSql<Text, DB>,
3838
DB: Backend,
@@ -56,7 +56,7 @@ where
5656
}
5757
}
5858

59-
impl<'a> From<String> for MigrationVersion<'a> {
59+
impl From<String> for MigrationVersion<'_> {
6060
fn from(s: String) -> Self {
6161
MigrationVersion(Cow::Owned(s))
6262
}
@@ -74,7 +74,7 @@ impl<'a> From<&'a String> for MigrationVersion<'a> {
7474
}
7575
}
7676

77-
impl<'a> Display for MigrationVersion<'a> {
77+
impl Display for MigrationVersion<'_> {
7878
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7979
f.write_str(self.0.as_ref())
8080
}
@@ -140,7 +140,7 @@ pub trait MigrationSource<DB: Backend> {
140140
fn migrations(&self) -> Result<Vec<Box<dyn Migration<DB>>>>;
141141
}
142142

143-
impl<'a, DB: Backend> Migration<DB> for Box<dyn Migration<DB> + 'a> {
143+
impl<DB: Backend> Migration<DB> for Box<dyn Migration<DB> + '_> {
144144
fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()> {
145145
(**self).run(conn)
146146
}
@@ -158,7 +158,7 @@ impl<'a, DB: Backend> Migration<DB> for Box<dyn Migration<DB> + 'a> {
158158
}
159159
}
160160

161-
impl<'a, DB: Backend> Migration<DB> for &'a dyn Migration<DB> {
161+
impl<DB: Backend> Migration<DB> for &dyn Migration<DB> {
162162
fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()> {
163163
(**self).run(conn)
164164
}

diesel/src/mysql/connection/raw.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl RawConnection {
3939
ffi::mysql_options(
4040
result.0.as_ptr(),
4141
ffi::mysql_option::MYSQL_SET_CHARSET_NAME,
42-
b"utf8mb4\0".as_ptr() as *const libc::c_void,
42+
c"utf8mb4".as_ptr() as *const libc::c_void,
4343
)
4444
};
4545
assert_eq!(

diesel/src/mysql/connection/stmt/iterator.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<'a> StatementIterator<'a> {
3838
}
3939
}
4040

41-
impl<'a> Iterator for StatementIterator<'a> {
41+
impl Iterator for StatementIterator<'_> {
4242
type Item = QueryResult<MysqlRow>;
4343

4444
fn next(&mut self) -> Option<Self::Item> {
@@ -125,7 +125,7 @@ impl<'a> Iterator for StatementIterator<'a> {
125125
}
126126
}
127127

128-
impl<'a> ExactSizeIterator for StatementIterator<'a> {
128+
impl ExactSizeIterator for StatementIterator<'_> {
129129
fn len(&self) -> usize {
130130
self.len
131131
}
@@ -154,7 +154,11 @@ impl PrivateMysqlRow {
154154
impl RowSealed for MysqlRow {}
155155

156156
impl<'a> Row<'a, Mysql> for MysqlRow {
157-
type Field<'f> = MysqlField<'f> where 'a: 'f, Self: 'f;
157+
type Field<'f>
158+
= MysqlField<'f>
159+
where
160+
'a: 'f,
161+
Self: 'f;
158162
type InnerPartialRow = Self;
159163

160164
fn field_count(&self) -> usize {

diesel/src/mysql/connection/stmt/metadata.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(in crate::mysql::connection) struct MysqlFieldMetadata<'a>(
4040
std::marker::PhantomData<&'a ()>,
4141
);
4242

43-
impl<'a> MysqlFieldMetadata<'a> {
43+
impl MysqlFieldMetadata<'_> {
4444
pub(in crate::mysql::connection) fn field_name(&self) -> Option<&str> {
4545
if self.0.name.is_null() {
4646
None

diesel/src/mysql/connection/stmt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub(super) struct StatementUse<'a> {
152152
inner: MaybeCached<'a, Statement>,
153153
}
154154

155-
impl<'a> StatementUse<'a> {
155+
impl StatementUse<'_> {
156156
pub(in crate::mysql::connection) fn affected_rows(&self) -> QueryResult<usize> {
157157
let affected_rows = unsafe { ffi::mysql_stmt_affected_rows(self.inner.stmt.as_ptr()) };
158158
affected_rows
@@ -211,7 +211,7 @@ impl<'a> StatementUse<'a> {
211211
}
212212
}
213213

214-
impl<'a> Drop for StatementUse<'a> {
214+
impl Drop for StatementUse<'_> {
215215
fn drop(&mut self) {
216216
unsafe {
217217
ffi::mysql_stmt_free_result(self.inner.stmt.as_ptr());

diesel/src/mysql/query_builder/limit_offset.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ where
3333
}
3434
}
3535

36-
impl<'a> QueryFragment<Mysql> for BoxedLimitOffsetClause<'a, Mysql> {
36+
impl QueryFragment<Mysql> for BoxedLimitOffsetClause<'_, Mysql> {
3737
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, Mysql>) -> QueryResult<()> {
3838
match (self.limit.as_ref(), self.offset.as_ref()) {
3939
(Some(limit), Some(offset)) => {

diesel/src/pg/connection/copy.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<'conn> CopyFromSink<'conn> {
2222
}
2323
}
2424

25-
impl<'conn> Write for CopyFromSink<'conn> {
25+
impl Write for CopyFromSink<'_> {
2626
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
2727
self.conn
2828
.put_copy_data(buf)
@@ -70,7 +70,7 @@ impl<'conn> CopyToBuffer<'conn> {
7070
}
7171
}
7272

73-
impl<'conn> Drop for CopyToBuffer<'conn> {
73+
impl Drop for CopyToBuffer<'_> {
7474
#[allow(unsafe_code)] // ffi code
7575
fn drop(&mut self) {
7676
if !self.ptr.is_null() {
@@ -80,7 +80,7 @@ impl<'conn> Drop for CopyToBuffer<'conn> {
8080
}
8181
}
8282

83-
impl<'conn> Read for CopyToBuffer<'conn> {
83+
impl Read for CopyToBuffer<'_> {
8484
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
8585
let data = self.fill_buf()?;
8686
let len = usize::min(buf.len(), data.len());
@@ -90,7 +90,7 @@ impl<'conn> Read for CopyToBuffer<'conn> {
9090
}
9191
}
9292

93-
impl<'conn> BufRead for CopyToBuffer<'conn> {
93+
impl BufRead for CopyToBuffer<'_> {
9494
#[allow(unsafe_code)] // ffi code + ptr arithmetic
9595
fn fill_buf(&mut self) -> std::io::Result<&[u8]> {
9696
if self.data_slice().is_empty() {

diesel/src/pg/connection/cursor.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'conn, 'query> RowByRowCursor<'conn, 'query> {
8585
}
8686
}
8787

88-
impl<'conn, 'query> Iterator for RowByRowCursor<'conn, 'query> {
88+
impl Iterator for RowByRowCursor<'_, '_> {
8989
type Item = crate::QueryResult<PgRow>;
9090

9191
fn next(&mut self) -> Option<Self::Item> {
@@ -122,7 +122,7 @@ impl<'conn, 'query> Iterator for RowByRowCursor<'conn, 'query> {
122122
}
123123
}
124124

125-
impl<'conn, 'query> Drop for RowByRowCursor<'conn, 'query> {
125+
impl Drop for RowByRowCursor<'_, '_> {
126126
fn drop(&mut self) {
127127
loop {
128128
let res = super::update_transaction_manager_status(

diesel/src/pg/connection/row.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ impl PgRow {
2121
impl RowSealed for PgRow {}
2222

2323
impl<'a> Row<'a, Pg> for PgRow {
24-
type Field<'f> = PgField<'f> where 'a: 'f, Self: 'f;
24+
type Field<'f>
25+
= PgField<'f>
26+
where
27+
'a: 'f,
28+
Self: 'f;
2529
type InnerPartialRow = Self;
2630

2731
fn field_count(&self) -> usize {
@@ -81,7 +85,7 @@ impl<'a> Field<'a, Pg> for PgField<'a> {
8185
}
8286
}
8387

84-
impl<'a> TypeOidLookup for PgField<'a> {
88+
impl TypeOidLookup for PgField<'_> {
8589
fn lookup(&self) -> std::num::NonZeroU32 {
8690
self.db_result.column_type(self.col_idx)
8791
}

diesel/src/pg/expression/array_comparison.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ where
164164
}
165165
}
166166

167-
impl<'a, ST, QS, DB, GB> AsArrayExpression<ST> for BoxedSelectStatement<'a, ST, QS, DB, GB>
167+
impl<ST, QS, DB, GB> AsArrayExpression<ST> for BoxedSelectStatement<'_, ST, QS, DB, GB>
168168
where
169169
ST: 'static,
170170
Self: SelectQuery<SqlType = ST>,

diesel/src/pg/expression/expression_methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,7 @@ pub(in crate::pg) mod private {
25072507
}
25082508
}
25092509

2510-
impl<'a> JsonRemoveIndex for Vec<&'a str> {
2510+
impl JsonRemoveIndex for Vec<&str> {
25112511
type Expression = crate::dsl::AsExprOf<Self, Array<Text>>;
25122512

25132513
fn into_json_index_expression(self) -> Self::Expression {

diesel/src/pg/query_builder/copy/copy_to.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl<'f> Field<'f, Pg> for CopyField<'f> {
152152
}
153153

154154
#[cfg(feature = "postgres")]
155-
impl<'a> TypeOidLookup for CopyField<'a> {
155+
impl TypeOidLookup for CopyField<'_> {
156156
fn lookup(&self) -> std::num::NonZeroU32 {
157157
self.result.column_type(self.col_idx)
158158
}
@@ -181,7 +181,8 @@ impl<'a> RowIndex<&'a str> for CopyRow<'_> {
181181

182182
#[cfg(feature = "postgres")]
183183
impl<'a> Row<'a, Pg> for CopyRow<'_> {
184-
type Field<'f> = CopyField<'f>
184+
type Field<'f>
185+
= CopyField<'f>
185186
where
186187
'a: 'f,
187188
Self: 'f;

diesel/src/pg/query_builder/limit_offset.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ where
1818
}
1919
}
2020

21-
impl<'a> QueryFragment<Pg> for BoxedLimitOffsetClause<'a, Pg> {
21+
impl QueryFragment<Pg> for BoxedLimitOffsetClause<'_, Pg> {
2222
fn walk_ast<'b>(&'b self, mut out: AstPass<'_, 'b, Pg>) -> QueryResult<()> {
2323
if let Some(ref limit) = self.limit {
2424
limit.walk_ast(out.reborrow())?;

0 commit comments

Comments
 (0)