Skip to content

Commit

Permalink
Allow building with Rust v1.84.0 or newer
Browse files Browse the repository at this point in the history
These changes allow building Vaultwarden using Rust v1.84.0 or newer.
The two lints specifically allowed are part of the `rust_2024_compatibility` list.
These two lint checks seem to have no impact on our code as far as i could tell.
Also building and running both 2021 edition and 2024 edition binary work fine.

Closes #5370

Signed-off-by: BlackDex <[email protected]>
  • Loading branch information
BlackDex committed Jan 9, 2025
1 parent dec3a96 commit f8880ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion src/api/notifications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl Drop for WSAnonymousEntryMapGuard {
}
}

#[allow(tail_expr_drop_order)]
#[get("/hub?<data..>")]
fn websockets_hub<'r>(
ws: WebSocket,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit f8880ab

Please sign in to comment.