@@ -4,7 +4,7 @@ use std::path::Path;
4
4
#[ test]
5
5
fn test_missing_tests ( ) {
6
6
let missing_files = explore_directory ( Path :: new ( "./tests" ) ) ;
7
- if missing_files. len ( ) > 0 {
7
+ if ! missing_files. is_empty ( ) {
8
8
assert ! (
9
9
false ,
10
10
format!(
@@ -31,25 +31,22 @@ fn explore_directory(dir: &Path) -> Vec<String> {
31
31
let mut current_file = String :: new ( ) ;
32
32
let mut files: Vec < DirEntry > = fs:: read_dir ( dir) . unwrap ( ) . filter_map ( Result :: ok) . collect ( ) ;
33
33
files. sort_by_key ( |e| e. path ( ) ) ;
34
- for entry in files. iter ( ) {
34
+ for entry in & files {
35
35
let path = entry. path ( ) ;
36
36
if path. is_dir ( ) {
37
37
missing_files. extend ( explore_directory ( & path) ) ;
38
38
} else {
39
39
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
+ } ;
53
50
}
54
51
}
55
52
}
0 commit comments