aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--build.rs7
-rw-r--r--src/db/models/attachment.rs2
-rw-r--r--src/db/models/collection.rs2
-rw-r--r--src/db/models/org_policy.rs2
-rw-r--r--src/db/models/two_factor.rs2
6 files changed, 11 insertions, 5 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/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 83f4889c..65855cc0 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 b10dd1d6..0d439757 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))
))
diff --git a/src/db/models/org_policy.rs b/src/db/models/org_policy.rs
index 6f6f894e..d1e8aa0f 100644
--- a/src/db/models/org_policy.rs
+++ b/src/db/models/org_policy.rs
@@ -115,7 +115,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 2120a0e2..9155c518 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")?;