diff --git a/clippy.toml b/clippy.toml index ab165574d129..eecd6bedae5d 100644 --- a/clippy.toml +++ b/clippy.toml @@ -8,3 +8,4 @@ doc-valid-idents = [ "JavaScript", "NaN", "OAuth", "SQLite", "PostgreSQL", "MySQL" ] +avoid-breaking-exported-api = false diff --git a/diesel/src/lib.rs b/diesel/src/lib.rs index 766392495459..b5831597b167 100644 --- a/diesel/src/lib.rs +++ b/diesel/src/lib.rs @@ -113,7 +113,6 @@ #![warn( clippy::unwrap_used, clippy::print_stdout, - clippy::wrong_pub_self_convention, clippy::mut_mut, clippy::non_ascii_literal, clippy::similar_names, diff --git a/diesel/src/mysql/connection/mod.rs b/diesel/src/mysql/connection/mod.rs index 1edf4b5e03ac..9b71dcb9e46c 100644 --- a/diesel/src/mysql/connection/mod.rs +++ b/diesel/src/mysql/connection/mod.rs @@ -48,7 +48,7 @@ impl CommitErrorProcessor for MysqlConnection { } TransactionManagerStatus::Valid(ref v) => v, }; - default_process_commit_error(&state, error) + default_process_commit_error(state, error) } } diff --git a/diesel/src/pg/expression/expression_methods.rs b/diesel/src/pg/expression/expression_methods.rs index 4a56a08d4185..28d53707f9b4 100644 --- a/diesel/src/pg/expression/expression_methods.rs +++ b/diesel/src/pg/expression/expression_methods.rs @@ -27,7 +27,7 @@ pub trait PgExpressionMethods: Expression + Sized { /// assert_eq!(Ok(1), not_distinct.first(connection)); /// # } /// ``` - #[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator + #[allow(clippy::wrong_self_convention)] // This is named after the sql operator fn is_not_distinct_from(self, other: T) -> dsl::IsNotDistinctFrom where Self::SqlType: SqlType, @@ -55,7 +55,7 @@ pub trait PgExpressionMethods: Expression + Sized { /// assert_eq!(Ok(1), not_distinct.first(connection)); /// # } /// ``` - #[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator + #[allow(clippy::wrong_self_convention)] // This is named after the sql operator fn is_distinct_from(self, other: T) -> dsl::IsDistinctFrom where Self::SqlType: SqlType, @@ -292,7 +292,7 @@ pub trait PgArrayExpressionMethods: Expression + Sized { /// # Ok(()) /// # } /// ``` - #[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator + #[allow(clippy::wrong_self_convention)] // This is named after the sql operator fn is_contained_by(self, other: T) -> dsl::IsContainedBy where Self::SqlType: SqlType, @@ -870,7 +870,7 @@ pub trait PgNetExpressionMethods: Expression + Sized { /// # Ok(()) /// # } /// ``` - #[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator + #[allow(clippy::wrong_self_convention)] // This is named after the sql operator fn is_contained_by(self, other: T) -> dsl::IsContainedByNet where T: AsExpression, @@ -928,7 +928,7 @@ pub trait PgNetExpressionMethods: Expression + Sized { /// # Ok(()) /// # } /// ``` - #[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator + #[allow(clippy::wrong_self_convention)] // This is named after the sql operator fn is_contained_by_or_eq(self, other: T) -> dsl::IsContainedByNetLoose where T: AsExpression, diff --git a/diesel/src/pg/metadata_lookup.rs b/diesel/src/pg/metadata_lookup.rs index 8768ad765330..58bc29af2f3f 100644 --- a/diesel/src/pg/metadata_lookup.rs +++ b/diesel/src/pg/metadata_lookup.rs @@ -46,7 +46,7 @@ where } } - let r = lookup_type(&&cache_key, self); + let r = lookup_type(&cache_key, self); match r { Ok(type_metadata) => { diff --git a/diesel/src/sqlite/connection/raw.rs b/diesel/src/sqlite/connection/raw.rs index 6cccf8043195..6f5f12049b8a 100644 --- a/diesel/src/sqlite/connection/raw.rs +++ b/diesel/src/sqlite/connection/raw.rs @@ -245,7 +245,7 @@ impl SqliteCallbackError { s = e.to_string(); &s } - SqliteCallbackError::Panic(_, msg) => &msg, + SqliteCallbackError::Panic(_, msg) => msg, }; unsafe { context_error_str(ctx, msg); diff --git a/diesel/src/sqlite/expression/expression_methods.rs b/diesel/src/sqlite/expression/expression_methods.rs index db7c43567f37..7d457ee1b4e7 100644 --- a/diesel/src/sqlite/expression/expression_methods.rs +++ b/diesel/src/sqlite/expression/expression_methods.rs @@ -70,7 +70,7 @@ pub trait SqliteExpressionMethods: Expression + Sized { /// # Ok(()) /// # } /// ``` - #[allow(clippy::clippy::wrong_self_convention)] // This is named after the sql operator + #[allow(clippy::wrong_self_convention)] // This is named after the sql operator fn is_not(self, other: T) -> dsl::IsNot where Self::SqlType: SqlType, diff --git a/diesel/src/util/once_cell.rs b/diesel/src/util/once_cell.rs index cb55e81e193e..96fac3073b40 100644 --- a/diesel/src/util/once_cell.rs +++ b/diesel/src/util/once_cell.rs @@ -84,7 +84,7 @@ impl OnceCell { // `assert`, while keeping `set/get` would be sound, but it seems // better to panic, rather than to silently use an old value. assert!(self.set(val).is_ok(), "reentrant init"); - self.get().unwrap() + self.get().expect("We set the value in the line above") } pub(crate) fn get(&self) -> Option<&T> { diff --git a/diesel_cli/src/infer_schema_internals/inference.rs b/diesel_cli/src/infer_schema_internals/inference.rs index cde7762dc48b..ae74e0147999 100644 --- a/diesel_cli/src/infer_schema_internals/inference.rs +++ b/diesel_cli/src/infer_schema_internals/inference.rs @@ -204,7 +204,7 @@ pub fn load_table_data( let primary_key = get_primary_keys(&mut connection, &name)?; let primary_key = primary_key .iter() - .map(|k| rust_name_for_sql_name(&k)) + .map(|k| rust_name_for_sql_name(k)) .collect(); let column_data = get_column_information(&mut connection, &name, column_sorting)? diff --git a/diesel_cli/src/infer_schema_internals/sqlite.rs b/diesel_cli/src/infer_schema_internals/sqlite.rs index 9aaad0f22ac4..d858bf543b86 100644 --- a/diesel_cli/src/infer_schema_internals/sqlite.rs +++ b/diesel_cli/src/infer_schema_internals/sqlite.rs @@ -109,7 +109,7 @@ impl SqliteVersion { fn get_sqlite_version(conn: &mut SqliteConnection) -> SqliteVersion { let query = "SELECT sqlite_version()"; - let result = sql::(&query).load::(conn).unwrap(); + let result = sql::(query).load::(conn).unwrap(); let parts = result[0] .split('.') .map(|part| part.parse().unwrap()) diff --git a/diesel_cli/src/main.rs b/diesel_cli/src/main.rs index a47f98d76c2d..118243f32160 100644 --- a/diesel_cli/src/main.rs +++ b/diesel_cli/src/main.rs @@ -9,8 +9,7 @@ clippy::non_ascii_literal, clippy::similar_names, clippy::unicode_not_nfc, - clippy::used_underscore_binding, - clippy::wrong_pub_self_convention + clippy::used_underscore_binding )] #![cfg_attr(test, allow(clippy::result_unwrap_used))] diff --git a/diesel_derives/src/insertable.rs b/diesel_derives/src/insertable.rs index 369fc90237f1..a7c9ccecf7ad 100644 --- a/diesel_derives/src/insertable.rs +++ b/diesel_derives/src/insertable.rs @@ -151,7 +151,7 @@ fn field_ty_serialize_as( let column_name = field.column_name(); if treat_none_as_default_value { - let inner_ty = inner_of_option_ty(&ty); + let inner_ty = inner_of_option_ty(ty); quote!( std::option::Option::into(x)))) } else { quote!(std::option::Option::Some(#column.eq(::std::convert::Into::<#ty>::into(self.#field_name)))) diff --git a/diesel_derives/src/lib.rs b/diesel_derives/src/lib.rs index 5ade47b6d63b..bbcd28561a0d 100644 --- a/diesel_derives/src/lib.rs +++ b/diesel_derives/src/lib.rs @@ -8,7 +8,6 @@ clippy::map_unwrap_or )] #![warn( - clippy::wrong_pub_self_convention, clippy::mut_mut, clippy::non_ascii_literal, clippy::similar_names, diff --git a/diesel_derives/src/sql_function.rs b/diesel_derives/src/sql_function.rs index 56f500816cfd..0aae2a37198e 100644 --- a/diesel_derives/src/sql_function.rs +++ b/diesel_derives/src/sql_function.rs @@ -493,7 +493,7 @@ fn is_sqlite_type(ty: &Type) -> bool { if ident == "Nullable" { if let PathArguments::AngleBracketed(ref ab) = last_segment.arguments { if let Some(GenericArgument::Type(ty)) = ab.args.first() { - return is_sqlite_type(&ty); + return is_sqlite_type(ty); } } return false; diff --git a/diesel_migrations/migrations_internals/src/lib.rs b/diesel_migrations/migrations_internals/src/lib.rs index fbdb77c7737f..24e54f82adcd 100644 --- a/diesel_migrations/migrations_internals/src/lib.rs +++ b/diesel_migrations/migrations_internals/src/lib.rs @@ -9,7 +9,6 @@ #![warn( clippy::unwrap_used, clippy::print_stdout, - clippy::wrong_pub_self_convention, clippy::mut_mut, clippy::non_ascii_literal, clippy::similar_names, diff --git a/diesel_migrations/migrations_macros/src/lib.rs b/diesel_migrations/migrations_macros/src/lib.rs index d719bef82ba4..486dc049c631 100644 --- a/diesel_migrations/migrations_macros/src/lib.rs +++ b/diesel_migrations/migrations_macros/src/lib.rs @@ -10,7 +10,6 @@ #![warn( clippy::unwrap_used, clippy::print_stdout, - clippy::wrong_pub_self_convention, clippy::mut_mut, clippy::non_ascii_literal, clippy::similar_names, diff --git a/diesel_migrations/src/file_based_migrations.rs b/diesel_migrations/src/file_based_migrations.rs index e18ce529faac..6fbb653de6bd 100644 --- a/diesel_migrations/src/file_based_migrations.rs +++ b/diesel_migrations/src/file_based_migrations.rs @@ -226,7 +226,7 @@ impl DieselMigrationName { } pub(crate) fn from_name(name: &str) -> Result { - let version = migrations_internals::version_from_string(&name) + let version = migrations_internals::version_from_string(name) .ok_or_else(|| MigrationError::UnknownMigrationFormat(PathBuf::from(name)))?; Ok(Self { name: name.to_owned(), diff --git a/diesel_migrations/src/lib.rs b/diesel_migrations/src/lib.rs index cbb3d6c97d9b..2ca0d664f610 100644 --- a/diesel_migrations/src/lib.rs +++ b/diesel_migrations/src/lib.rs @@ -4,7 +4,6 @@ #![allow(clippy::needless_pass_by_value, clippy::map_unwrap_or)] #![warn( missing_docs, - clippy::wrong_pub_self_convention, clippy::mut_mut, clippy::non_ascii_literal, clippy::similar_names,