version: Use fastrand v2.0.0

This commit is contained in:
John Nunley 2023-07-03 07:59:34 -07:00 committed by GitHub
parent 4a1e18daf9
commit abb7a4e9ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -49,9 +49,12 @@ fn create_memfile() -> File {
};
use std::iter;
// Use a cached RNG to avoid hammering the thread local.
let mut rng = fastrand::Rng::new();
for _ in 0..=4 {
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');
let name = unsafe { CStr::from_bytes_with_nul_unchecked(name.as_bytes()) };