@@ -13,7 +13,7 @@ use aml::{AmlContext, DebugVerbosity};
13
13
use clap:: { Arg , ArgAction , ArgGroup } ;
14
14
use std:: {
15
15
cell:: RefCell ,
16
- collections:: { HashMap , HashSet } ,
16
+ collections:: HashSet ,
17
17
ffi:: OsStr ,
18
18
fs:: { self , File } ,
19
19
io:: { Read , Write } ,
@@ -55,8 +55,8 @@ fn main() -> std::io::Result<()> {
55
55
println ! ( "Running tests in directory: {:?}" , dir_path) ;
56
56
fs:: read_dir ( dir_path) ?
57
57
. filter_map ( |entry| {
58
- if entry . is_ok ( ) {
59
- Some ( entry. unwrap ( ) . path ( ) . to_string_lossy ( ) . to_string ( ) )
58
+ if let Ok ( entry ) = entry {
59
+ Some ( entry. path ( ) . to_string_lossy ( ) . to_string ( ) )
60
60
} else {
61
61
None
62
62
}
@@ -67,15 +67,18 @@ fn main() -> std::io::Result<()> {
67
67
} ;
68
68
69
69
// Make sure all files exist, propagate error if it occurs
70
- files. iter ( ) . fold ( Ok ( ( ) ) , |result : std:: io:: Result < ( ) > , file| {
70
+ let mut result = Ok ( ( ) ) ;
71
+ for file in files. iter ( ) {
71
72
let path = Path :: new ( file) ;
72
73
if !path. is_file ( ) {
73
74
println ! ( "Not a regular file: {}" , file) ;
74
75
// Get the io error if there is one
75
- path. metadata ( ) ?;
76
+ if let Err ( e) = path. metadata ( ) {
77
+ result = Err ( e) ;
78
+ }
76
79
}
77
- result
78
- } ) ?;
80
+ }
81
+ result ?;
79
82
80
83
// Make sure we have the ability to compile ASL -> AML, if user wants it
81
84
let user_wants_compile = !matches. get_flag ( "no_compile" ) ;
0 commit comments