From d0de17329d955685bbed37cc49ad9c03230a8ed5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 03:43:17 +0000 Subject: [PATCH 1/2] build(deps): bump rand from 0.8.8 to 0.10.2 Bumps [rand](https://github.com/rust-random/rand) from 0.8.8 to 0.10.2. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/rand/compare/0.8.8...0.10.2) --- updated-dependencies: - dependency-name: rand dependency-version: 0.10.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- crates/x-media/Cargo.toml | 2 +- crates/xmedia-bot/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7167975..367573d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2865,7 +2865,7 @@ dependencies = [ "dotenv", "html-escape", "log", - "rand 0.8.8", + "rand 0.10.2", "regex", "reqwest", "serde", @@ -2890,7 +2890,7 @@ dependencies = [ "parking_lot", "png", "pretty_env_logger", - "rand 0.8.8", + "rand 0.10.2", "rusqlite", "serde", "serde_json", diff --git a/crates/x-media/Cargo.toml b/crates/x-media/Cargo.toml index a6ce0be..b96e6a5 100644 --- a/crates/x-media/Cargo.toml +++ b/crates/x-media/Cargo.toml @@ -14,7 +14,7 @@ bytes = "1" zip = "2" tempfile = "3" thiserror = "2" -rand = "0.8" +rand = "0.10" log = "0.4" tokio = { version = "1.40", features = ["time"] } diff --git a/crates/xmedia-bot/Cargo.toml b/crates/xmedia-bot/Cargo.toml index 10d248d..07215fd 100644 --- a/crates/xmedia-bot/Cargo.toml +++ b/crates/xmedia-bot/Cargo.toml @@ -14,7 +14,7 @@ dotenv = "0.15" url = "2.5.2" html-escape = "0.2" rusqlite = { version = "0.32", features = ["bundled"] } -rand = "0.8" +rand = "0.10" tempfile = "3" parking_lot = "0.12" bytes = "1" From 9529f64b41ba6879942ee0e6dff2c7007d94e771 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Thu, 17 Sep 2026 16:43:01 +0800 Subject: [PATCH 2/2] fix(send): migrate rand usage to the 0.10 API rand 0.10 renamed the entry points dependabot's version bump alone cannot follow: `thread_rng()` -> `rng()`, `gen_range()` -> `random_range()` and the `Rng` trait -> `RngExt`. The jitter only needs one float, so use the free function `rand::random_range(0.2..0.8)` and drop the now-unused trait import instead of importing `RngExt`. Verified: cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace --locked (retry_delay_seconds_bounds keeps the 0.2..0.8 jitter window). --- crates/xmedia-bot/src/send/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/xmedia-bot/src/send/mod.rs b/crates/xmedia-bot/src/send/mod.rs index abafe91..544c1c6 100644 --- a/crates/xmedia-bot/src/send/mod.rs +++ b/crates/xmedia-bot/src/send/mod.rs @@ -17,7 +17,6 @@ use crate::link_cache::{CachedMedia, CachedMediaKind, CachedPost}; use crate::media_sender::MediaSender; use input_media::{build_media_group, input_file_for, item_url}; use post_send::{cache_animation_send, cache_sent_task}; -use rand::Rng; use serde::{Deserialize, Serialize}; use std::sync::LazyLock; use teloxide::prelude::*; @@ -261,7 +260,7 @@ pub fn photos_first(items: Vec) -> Vec { /// Exponential backoff with jitter, capped at 30s. pub fn retry_delay_seconds(attempts: u32) -> f64 { - let jitter: f64 = rand::thread_rng().gen_range(0.2..0.8); + let jitter: f64 = rand::random_range(0.2..0.8); (2f64.powi(attempts as i32) + jitter).min(30.0) }