version: Use fastrand v2.0.0
This commit is contained in:
parent
4a1e18daf9
commit
abb7a4e9ac
2 changed files with 5 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ wayland-sys = "0.30.0"
|
||||||
x11rb = { version = "0.12.0", features = ["allow-unsafe-code", "shm"], optional = true }
|
x11rb = { version = "0.12.0", features = ["allow-unsafe-code", "shm"], optional = true }
|
||||||
|
|
||||||
[target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox", target_os = "linux", target_os = "freebsd"))))'.dependencies]
|
[target.'cfg(all(unix, not(any(target_vendor = "apple", target_os = "android", target_os = "redox", target_os = "linux", target_os = "freebsd"))))'.dependencies]
|
||||||
fastrand = { version = "1.8.0", optional = true }
|
fastrand = { version = "2.0.0", optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
|
[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
|
||||||
version = "0.48.0"
|
version = "0.48.0"
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,12 @@ fn create_memfile() -> File {
|
||||||
};
|
};
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
||||||
|
// Use a cached RNG to avoid hammering the thread local.
|
||||||
|
let mut rng = fastrand::Rng::new();
|
||||||
|
|
||||||
for _ in 0..=4 {
|
for _ in 0..=4 {
|
||||||
let mut name = String::from("softbuffer-");
|
let mut name = String::from("softbuffer-");
|
||||||
name.extend(iter::repeat_with(fastrand::alphanumeric).take(7));
|
name.extend(iter::repeat_with(|| rng.alphanumeric()).take(7));
|
||||||
name.push('\0');
|
name.push('\0');
|
||||||
|
|
||||||
let name = unsafe { CStr::from_bytes_with_nul_unchecked(name.as_bytes()) };
|
let name = unsafe { CStr::from_bytes_with_nul_unchecked(name.as_bytes()) };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue