Skip to content

Commit 38b3a4e

Browse files
author
Unknown
committed
Fixing issues pointed out by dogfood tests.
1 parent a3b3a54 commit 38b3a4e

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

Diff for: tests/missing-test-files.rs

+12-15
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::path::Path;
44
#[test]
55
fn test_missing_tests() {
66
let missing_files = explore_directory(Path::new("./tests"));
7-
if missing_files.len() > 0 {
7+
if !missing_files.is_empty() {
88
assert!(
99
false,
1010
format!(
@@ -31,25 +31,22 @@ fn explore_directory(dir: &Path) -> Vec<String> {
3131
let mut current_file = String::new();
3232
let mut files: Vec<DirEntry> = fs::read_dir(dir).unwrap().filter_map(Result::ok).collect();
3333
files.sort_by_key(|e| e.path());
34-
for entry in files.iter() {
34+
for entry in &files {
3535
let path = entry.path();
3636
if path.is_dir() {
3737
missing_files.extend(explore_directory(&path));
3838
} else {
3939
let file_stem = path.file_stem().unwrap().to_str().unwrap().to_string();
40-
match path.extension() {
41-
Some(ext) => {
42-
match ext.to_str().unwrap() {
43-
"rs" => current_file = file_stem.clone(),
44-
"stderr" | "stdout" => {
45-
if file_stem != current_file {
46-
missing_files.push(path.to_str().unwrap().to_string());
47-
}
48-
},
49-
_ => continue,
50-
};
51-
},
52-
None => {},
40+
if let Some(ext) = path.extension() {
41+
match ext.to_str().unwrap() {
42+
"rs" => current_file = file_stem.clone(),
43+
"stderr" | "stdout" => {
44+
if file_stem != current_file {
45+
missing_files.push(path.to_str().unwrap().to_string());
46+
}
47+
},
48+
_ => continue,
49+
};
5350
}
5451
}
5552
}

0 commit comments

Comments
 (0)