build(deps): update to rusqlite 0.34, rustix 1 and fix warnings

This commit is contained in:
oxalica 2025-03-18 11:12:46 -04:00
parent 740e540b4b
commit 37fbf5149e
8 changed files with 312 additions and 222 deletions

View file

@ -0,0 +1,2 @@
[default.extend-words]
typ = "typ"

497
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -27,7 +27,7 @@ thiserror = "2"
url = { version = "2", features = ["serde"] }
[dependencies.rusqlite]
version = "0.33"
version = "0.34"
optional = true
[dependencies.schemars]

View file

@ -62,7 +62,7 @@ fn avg_msg() -> ChatPayload {
// the last 1 year data from <https://t.me/nixos_zhcn>
ChatPayload {
rich_text: "🤔️ average length message! 平均长度消息".into(),
room: Id(1_234_567_890_000 << 16 | 0xDEAD),
room: Id((1_234_567_890_000 << 16) | 0xDEAD),
}
}

View file

@ -10,7 +10,7 @@ ed25519-dalek = { version = "2", features = ["pkcs8", "pem", "rand_core"] }
humantime = "2"
rand = "0.8"
reqwest = { version = "0.12", features = ["json"] }
rusqlite = { version = "0.33", features = ["rusqlite-macros"] }
rusqlite = { version = "0.34", features = ["rusqlite-macros"] }
serde_jcs = "0.1.0"
serde_json = "1"
tokio = { version = "1", features = ["rt", "macros"] }

View file

@ -23,8 +23,8 @@ parking_lot = "0.12" # Maybe no better performance, just that we hate poisoning.
paste = "1.0.15"
rand = "0.8"
reqwest = "0.12"
rusqlite = { version = "0.33", features = ["rusqlite-macros"] }
rustix = { version = "0.38", features = ["net"] }
rusqlite = { version = "0.34", features = ["rusqlite-macros"] }
rustix = { version = "1", features = ["net"] }
sd-notify = "0.4"
serde = { version = "1", features = ["derive"] }
serde-constant = "0.1"

View file

@ -65,7 +65,7 @@ async fn main_serve(db: Database, config: Config) -> Result<()> {
.context("failed to listen on socket")?,
),
ListenConfig::Systemd(_) => {
use rustix::net::{getsockname, SocketAddrAny};
use rustix::net::{getsockname, SocketAddr};
let [fd] = sd_notify::listen_fds()
.context("failed to get fds from sd_listen_fds(3)")?
@ -76,19 +76,18 @@ async fn main_serve(db: Database, config: Config) -> Result<()> {
let listener = unsafe { OwnedFd::from_raw_fd(fd) };
let addr = getsockname(&listener).context("failed to getsockname")?;
match addr {
SocketAddrAny::V4(_) | SocketAddrAny::V6(_) => {
let listener = std::net::TcpListener::from(listener);
listener
.set_nonblocking(true)
.context("failed to set socket non-blocking")?;
let listener = tokio::net::TcpListener::from_std(listener)
.context("failed to register async socket")?;
(format!("tcp socket {addr:?} from LISTEN_FDS"), listener)
}
if let Ok(addr) = SocketAddr::try_from(addr.clone()) {
let listener = std::net::TcpListener::from(listener);
listener
.set_nonblocking(true)
.context("failed to set socket non-blocking")?;
let listener = tokio::net::TcpListener::from_std(listener)
.context("failed to register async socket")?;
(format!("tcp socket {addr:?} from LISTEN_FDS"), listener)
} else {
// Unix socket support for axum is currently overly complex.
// WAIT: https://github.com/tokio-rs/axum/pull/2479
_ => bail!("unsupported socket type from LISTEN_FDS: {addr:?}"),
bail!("unsupported socket type from LISTEN_FDS: {addr:?}");
}
}
};

View file

@ -111,7 +111,7 @@ impl<T: fmt::Debug> ResultExt for Result<T> {
assert_eq!(
(err.status, &*err.code),
(status, code),
"unexpecteed API error: {err}",
"unexpected API error: {err}",
);
}