mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
tests: update random_chars generator to map u8 to char
Fix 'value of type `char` cannot be built from `std::iter::Iterator<Item=u8>`' for split test. refs: https://docs.rs/rand/0.8.4/rand/distributions/struct.Alphanumeric.html#example
This commit is contained in:
parent
cae6bc5e82
commit
771c9f5d9c
1 changed files with 1 additions and 0 deletions
|
@ -22,6 +22,7 @@ use std::{
|
||||||
fn random_chars(n: usize) -> String {
|
fn random_chars(n: usize) -> String {
|
||||||
thread_rng()
|
thread_rng()
|
||||||
.sample_iter(&rand::distributions::Alphanumeric)
|
.sample_iter(&rand::distributions::Alphanumeric)
|
||||||
|
.map(char::from)
|
||||||
.take(n)
|
.take(n)
|
||||||
.collect::<String>()
|
.collect::<String>()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue