From 98caeb2de3b67bf1013783e2c0e46cc25218e46a Mon Sep 17 00:00:00 2001 From: lukacan Date: Mon, 5 Feb 2024 14:38:45 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20review=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/test_generator.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/client/src/test_generator.rs b/crates/client/src/test_generator.rs index 85748ac0..c3513612 100644 --- a/crates/client/src/test_generator.rs +++ b/crates/client/src/test_generator.rs @@ -214,8 +214,13 @@ impl TestGenerator { } else { let mut directories: std::collections::HashSet<_> = fuzz_dir_path .read_dir() - .unwrap() - .map(|r| r.unwrap().file_name().to_str().unwrap().to_string()) + .expect("Reading directory failed") + .map(|r| { + r.expect("Reading directory; DirEntry error") + .file_name() + .to_string_lossy() + .to_string() + }) .collect(); // INFO discard known entries created by framework, everything else @@ -226,7 +231,7 @@ impl TestGenerator { let mut fuzz_id = directories.len(); loop { let fuzz_test = format!("fuzz_{fuzz_id}"); - if directories.contains(&fuzz_test) { + if directories.contains(&fuzz_test) && fuzz_id < usize::MAX { fuzz_id += 1; } else { break fuzz_id;