git: 51c1d2b650ff - main - security/vaultwarden: Fix build with rust 1.84.0

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Mon, 20 Jan 2025 11:07:25 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=51c1d2b650ff4ca6e3ac66d7badadf0a1f57973f

commit 51c1d2b650ff4ca6e3ac66d7badadf0a1f57973f
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2025-01-16 09:12:14 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2025-01-20 11:05:45 +0000

    security/vaultwarden: Fix build with rust 1.84.0
    
    Import upstream patch [1]
    
    [1] https://github.com/dani-garcia/vaultwarden/commit/10d12676cf11566ea33f49bbdc207bc417be7225
    
    PR:             283962
---
 security/vaultwarden/files/patch-rust-1.84.0 | 57 ++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/security/vaultwarden/files/patch-rust-1.84.0 b/security/vaultwarden/files/patch-rust-1.84.0
new file mode 100644
index 000000000000..dd432e878e90
--- /dev/null
+++ b/security/vaultwarden/files/patch-rust-1.84.0
@@ -0,0 +1,57 @@
+https://github.com/dani-garcia/vaultwarden/pull/5371
+https://github.com/dani-garcia/vaultwarden/commit/10d12676cf11566ea33f49bbdc207bc417be7225
+
+From 10d12676cf11566ea33f49bbdc207bc417be7225 Mon Sep 17 00:00:00 2001
+From: Mathijs van Veluw <black.dex@gmail.com>
+Date: Thu, 9 Jan 2025 12:33:02 +0100
+Subject: [PATCH] Allow building with Rust v1.84.0 or newer (#5371)
+
+---
+ Cargo.toml               | 4 ++++
+ src/api/notifications.rs | 4 +++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index a5c320d8e0..547de58e3a 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -230,6 +230,10 @@ unused_import_braces = "deny"
+ unused_lifetimes = "deny"
+ unused_qualifications = "deny"
+ variant_size_differences = "deny"
++# Allow the following lints since these cause issues with Rust v1.84.0 or newer
++# Building Vaultwarden with Rust v1.85.0 and edition 2024 also works without issues
++if_let_rescope = "allow"
++tail_expr_drop_order = "allow"
+ 
+ # https://rust-lang.github.io/rust-clippy/stable/index.html
+ [lints.clippy]
+diff --git a/src/api/notifications.rs b/src/api/notifications.rs
+index 8c925e37bb..9a53b95ffc 100644
+--- a/src/api/notifications.rs
++++ b/src/api/notifications.rs
+@@ -101,6 +101,7 @@ impl Drop for WSAnonymousEntryMapGuard {
+     }
+ }
+ 
++#[allow(tail_expr_drop_order)]
+ #[get("/hub?<data..>")]
+ fn websockets_hub<'r>(
+     ws: WebSocket,
+@@ -186,6 +187,7 @@ fn websockets_hub<'r>(
+     })
+ }
+ 
++#[allow(tail_expr_drop_order)]
+ #[get("/anonymous-hub?<token..>")]
+ fn anonymous_websockets_hub<'r>(ws: WebSocket, token: String, ip: ClientIp) -> Result<rocket_ws::Stream!['r], Error> {
+     let addr = ip.ip;
+@@ -290,7 +292,7 @@ fn serialize(val: Value) -> Vec<u8> {
+ fn serialize_date(date: NaiveDateTime) -> Value {
+     let seconds: i64 = date.and_utc().timestamp();
+     let nanos: i64 = date.and_utc().timestamp_subsec_nanos().into();
+-    let timestamp = nanos << 34 | seconds;
++    let timestamp = (nanos << 34) | seconds;
+ 
+     let bs = timestamp.to_be_bytes();
+