@@ -13,7 +13,7 @@ use aml::{AmlContext, DebugVerbosity};
1313use clap:: { Arg , ArgAction , ArgGroup } ;
1414use std:: {
1515 cell:: RefCell ,
16- collections:: { HashMap , HashSet } ,
16+ collections:: HashSet ,
1717 ffi:: OsStr ,
1818 fs:: { self , File } ,
1919 io:: { Read , Write } ,
@@ -55,8 +55,8 @@ fn main() -> std::io::Result<()> {
5555 println ! ( "Running tests in directory: {:?}" , dir_path) ;
5656 fs:: read_dir ( dir_path) ?
5757 . 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 ( ) )
6060 } else {
6161 None
6262 }
@@ -67,15 +67,18 @@ fn main() -> std::io::Result<()> {
6767 } ;
6868
6969 // 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 ( ) {
7172 let path = Path :: new ( file) ;
7273 if !path. is_file ( ) {
7374 println ! ( "Not a regular file: {}" , file) ;
7475 // Get the io error if there is one
75- path. metadata ( ) ?;
76+ if let Err ( e) = path. metadata ( ) {
77+ result = Err ( e) ;
78+ }
7679 }
77- result
78- } ) ?;
80+ }
81+ result ?;
7982
8083 // Make sure we have the ability to compile ASL -> AML, if user wants it
8184 let user_wants_compile = !matches. get_flag ( "no_compile" ) ;
0 commit comments