Skip to content

Commit 267de9c

Browse files
committed
Update dependences.
Switch dependency on "rand"/"random" to "fastrandom". We don't need the complexity for unique ids and the newer version of rand is even more complex.
1 parent f002039 commit 267de9c

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

Cargo.toml

+6-9
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ sxd-document = "0.3"
2424
sxd-xpath = "0.4"
2525
yaml-rust = "0.4"
2626
lazy_static = "1.4"
27-
strum = "0.26"
28-
strum_macros = "0.26"
27+
strum = "0.27.1"
28+
strum_macros = "0.27.1"
2929
error-chain = "0.12.4"
3030
regex = "1.10"
3131
dirs = "6.0"
3232
bitflags = "2.5"
3333
phf = { version = "0.11", features = ["macros"] }
34-
rand = "0.8"
3534
roman-numerals-rs = "3.1.0"
3635
radix_fmt = "1.0"
3736
unicode-script = "0.5"
@@ -40,15 +39,13 @@ env_logger = "0.11"
4039
cfg-if = "1.0"
4140
[target.'cfg(target_family = "wasm")'.dependencies]
4241
zip = { version = "2.1", default-features = false, features = ["deflate"] }
42+
fastrand = { version = "2.3.0", features = ["js"] }
43+
4344
[target.'cfg(not(target_family = "wasm"))'.dependencies]
4445
zip = { version = "2.1", default-features = false, features = ["bzip2"] }
46+
fastrand = { version = "2.3.0" }
4547

46-
[dependencies.getrandom]
47-
version = "0.2"
48-
features = ["js"]
49-
50-
[target.'cfg(target_os = "android")'.dependencies]
51-
android_logger = {version = "0.14.1", optional = true}
48+
android_logger = {version = "0.15.0", optional = true}
5249

5350
# # dependencies because of need to build wasm version for file i/o
5451
# yew = "0.18.0"

src/interface.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -543,15 +543,15 @@ pub fn errors_to_string(e: &Error) -> String {
543543
fn add_ids(mathml: Element) -> Element {
544544
use std::time::SystemTime;
545545
let time = if cfg!(target_family = "wasm") {
546-
rand::random::<usize>()
546+
fastrand::usize(..)
547547
} else {
548548
SystemTime::now()
549549
.duration_since(SystemTime::UNIX_EPOCH)
550550
.unwrap()
551551
.as_millis() as usize
552552
};
553553
let time_part = radix_fmt::radix(time, 36).to_string();
554-
let random_part = radix_fmt::radix(rand::random::<usize>(), 36).to_string();
554+
let random_part = radix_fmt::radix(fastrand::u32(..), 36).to_string();
555555
let prefix = "M".to_string() + &time_part[time_part.len() - 3..] + &random_part[random_part.len() - 4..] + "-"; // begin with letter
556556
add_ids_to_all(mathml, &prefix, 0);
557557
return mathml;

0 commit comments

Comments
 (0)