Skip to content

Commit 99ecace

Browse files
committed
Fix new clippy warnings
1 parent cbc7ef3 commit 99ecace

18 files changed

Lines changed: 18 additions & 23 deletions

File tree

clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ doc-valid-idents = [
88
"JavaScript", "NaN", "OAuth",
99
"SQLite", "PostgreSQL", "MySQL"
1010
]
11+
avoid-breaking-exported-api = false

diesel/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
#![warn(
114114
clippy::unwrap_used,
115115
clippy::print_stdout,
116-
clippy::wrong_pub_self_convention,
117116
clippy::mut_mut,
118117
clippy::non_ascii_literal,
119118
clippy::similar_names,

diesel/src/mysql/connection/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl CommitErrorProcessor for MysqlConnection {
4848
}
4949
TransactionManagerStatus::Valid(ref v) => v,
5050
};
51-
default_process_commit_error(&state, error)
51+
default_process_commit_error(state, error)
5252
}
5353
}
5454

diesel/src/pg/expression/expression_methods.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait PgExpressionMethods: Expression + Sized {
2727
/// assert_eq!(Ok(1), not_distinct.first(connection));
2828
/// # }
2929
/// ```
30-
#[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator
30+
#[allow(clippy::wrong_self_convention)] // This is named after the sql operator
3131
fn is_not_distinct_from<T>(self, other: T) -> dsl::IsNotDistinctFrom<Self, T>
3232
where
3333
Self::SqlType: SqlType,
@@ -55,7 +55,7 @@ pub trait PgExpressionMethods: Expression + Sized {
5555
/// assert_eq!(Ok(1), not_distinct.first(connection));
5656
/// # }
5757
/// ```
58-
#[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator
58+
#[allow(clippy::wrong_self_convention)] // This is named after the sql operator
5959
fn is_distinct_from<T>(self, other: T) -> dsl::IsDistinctFrom<Self, T>
6060
where
6161
Self::SqlType: SqlType,
@@ -292,7 +292,7 @@ pub trait PgArrayExpressionMethods: Expression + Sized {
292292
/// # Ok(())
293293
/// # }
294294
/// ```
295-
#[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator
295+
#[allow(clippy::wrong_self_convention)] // This is named after the sql operator
296296
fn is_contained_by<T>(self, other: T) -> dsl::IsContainedBy<Self, T>
297297
where
298298
Self::SqlType: SqlType,
@@ -870,7 +870,7 @@ pub trait PgNetExpressionMethods: Expression + Sized {
870870
/// # Ok(())
871871
/// # }
872872
/// ```
873-
#[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator
873+
#[allow(clippy::wrong_self_convention)] // This is named after the sql operator
874874
fn is_contained_by<T>(self, other: T) -> dsl::IsContainedByNet<Self, T>
875875
where
876876
T: AsExpression<Inet>,
@@ -928,7 +928,7 @@ pub trait PgNetExpressionMethods: Expression + Sized {
928928
/// # Ok(())
929929
/// # }
930930
/// ```
931-
#[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator
931+
#[allow(clippy::wrong_self_convention)] // This is named after the sql operator
932932
fn is_contained_by_or_eq<T>(self, other: T) -> dsl::IsContainedByNetLoose<Self, T>
933933
where
934934
T: AsExpression<Inet>,

diesel/src/pg/metadata_lookup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ where
4646
}
4747
}
4848

49-
let r = lookup_type(&&cache_key, self);
49+
let r = lookup_type(&cache_key, self);
5050

5151
match r {
5252
Ok(type_metadata) => {

diesel/src/sqlite/connection/raw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ impl SqliteCallbackError {
245245
s = e.to_string();
246246
&s
247247
}
248-
SqliteCallbackError::Panic(_, msg) => &msg,
248+
SqliteCallbackError::Panic(_, msg) => msg,
249249
};
250250
unsafe {
251251
context_error_str(ctx, msg);

diesel/src/sqlite/expression/expression_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub trait SqliteExpressionMethods: Expression + Sized {
7070
/// # Ok(())
7171
/// # }
7272
/// ```
73-
#[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator
73+
#[allow(clippy::wrong_self_convention)] // This is named after the sql operator
7474
fn is_not<T>(self, other: T) -> dsl::IsNot<Self, T>
7575
where
7676
Self::SqlType: SqlType,

diesel/src/util/once_cell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<T> OnceCell<T> {
8484
// `assert`, while keeping `set/get` would be sound, but it seems
8585
// better to panic, rather than to silently use an old value.
8686
assert!(self.set(val).is_ok(), "reentrant init");
87-
self.get().unwrap()
87+
self.get().expect("We set the value in the line above")
8888
}
8989

9090
pub(crate) fn get(&self) -> Option<&T> {

diesel_cli/src/infer_schema_internals/inference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ pub fn load_table_data(
204204
let primary_key = get_primary_keys(&mut connection, &name)?;
205205
let primary_key = primary_key
206206
.iter()
207-
.map(|k| rust_name_for_sql_name(&k))
207+
.map(|k| rust_name_for_sql_name(k))
208208
.collect();
209209

210210
let column_data = get_column_information(&mut connection, &name, column_sorting)?

diesel_cli/src/infer_schema_internals/sqlite.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl SqliteVersion {
109109

110110
fn get_sqlite_version(conn: &mut SqliteConnection) -> SqliteVersion {
111111
let query = "SELECT sqlite_version()";
112-
let result = sql::<sql_types::Text>(&query).load::<String>(conn).unwrap();
112+
let result = sql::<sql_types::Text>(query).load::<String>(conn).unwrap();
113113
let parts = result[0]
114114
.split('.')
115115
.map(|part| part.parse().unwrap())

0 commit comments

Comments
 (0)