From 9082e7cebb5b3c507f189f4438fd78ee1df1e6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Thu, 20 Jun 2024 09:35:52 +0200 Subject: [PATCH 1/2] Fix some nightly build errors (#4657) --- build.rs | 7 +++++++ src/db/models/attachment.rs | 2 +- src/db/models/collection.rs | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index e7bfb7de..07bd99a7 100644 --- a/build.rs +++ b/build.rs @@ -17,6 +17,13 @@ fn main() { "You need to enable one DB backend. To build with previous defaults do: cargo build --features sqlite" ); + // Use check-cfg to let cargo know which cfg's we define, + // and avoid warnings when they are used in the code. + println!("cargo::rustc-check-cfg=cfg(sqlite)"); + println!("cargo::rustc-check-cfg=cfg(mysql)"); + println!("cargo::rustc-check-cfg=cfg(postgresql)"); + println!("cargo::rustc-check-cfg=cfg(query_logger)"); + // Rerun when these paths are changed. // Someone could have checked-out a tag or specific commit, but no other files changed. println!("cargo:rerun-if-changed=.git"); diff --git a/src/db/models/attachment.rs b/src/db/models/attachment.rs index f8eca72f..9e6fa78a 100644 --- a/src/db/models/attachment.rs +++ b/src/db/models/attachment.rs @@ -95,7 +95,7 @@ impl Attachment { pub async fn delete(&self, conn: &mut DbConn) -> EmptyResult { db_run! { conn: { - crate::util::retry( + let _: () = crate::util::retry( || diesel::delete(attachments::table.filter(attachments::id.eq(&self.id))).execute(conn), 10, ) diff --git a/src/db/models/collection.rs b/src/db/models/collection.rs index ae70c76c..fc3c6e28 100644 --- a/src/db/models/collection.rs +++ b/src/db/models/collection.rs @@ -632,7 +632,7 @@ impl CollectionUser { db_run! { conn: { for user in collectionusers { - diesel::delete(users_collections::table.filter( + let _: () = diesel::delete(users_collections::table.filter( users_collections::user_uuid.eq(user_uuid) .and(users_collections::collection_uuid.eq(user.collection_uuid)) )) From 8f05a90b96adfe06722d01510923759fe61a8bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Thu, 20 Jun 2024 20:25:40 +0200 Subject: [PATCH 2/2] Fix some more nightly errors and remove lint that will become an error by default (#4661) --- Cargo.toml | 1 - src/db/models/org_policy.rs | 2 +- src/db/models/two_factor.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5ab84350..9094801b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -211,7 +211,6 @@ non_ascii_idents = "forbid" # Deny future_incompatible = { level = "deny", priority = -1 } noop_method_call = "deny" -pointer_structural_match = "deny" rust_2018_idioms = { level = "deny", priority = -1 } rust_2021_compatibility = { level = "deny", priority = -1 } trivial_casts = "deny" diff --git a/src/db/models/org_policy.rs b/src/db/models/org_policy.rs index 18bbdcd3..e3e7e31a 100644 --- a/src/db/models/org_policy.rs +++ b/src/db/models/org_policy.rs @@ -114,7 +114,7 @@ impl OrgPolicy { // We need to make sure we're not going to violate the unique constraint on org_uuid and atype. // This happens automatically on other DBMS backends due to replace_into(). PostgreSQL does // not support multiple constraints on ON CONFLICT clauses. - diesel::delete( + let _: () = diesel::delete( org_policies::table .filter(org_policies::org_uuid.eq(&self.org_uuid)) .filter(org_policies::atype.eq(&self.atype)), diff --git a/src/db/models/two_factor.rs b/src/db/models/two_factor.rs index 530e35b4..352fbed1 100644 --- a/src/db/models/two_factor.rs +++ b/src/db/models/two_factor.rs @@ -95,7 +95,7 @@ impl TwoFactor { // We need to make sure we're not going to violate the unique constraint on user_uuid and atype. // This happens automatically on other DBMS backends due to replace_into(). PostgreSQL does // not support multiple constraints on ON CONFLICT clauses. - diesel::delete(twofactor::table.filter(twofactor::user_uuid.eq(&self.user_uuid)).filter(twofactor::atype.eq(&self.atype))) + let _: () = diesel::delete(twofactor::table.filter(twofactor::user_uuid.eq(&self.user_uuid)).filter(twofactor::atype.eq(&self.atype))) .execute(conn) .map_res("Error deleting twofactor for insert")?;