Skip to content

Commit 1505d37

Browse files
committed
aml_tester: fix clippy warnings
1 parent bc88428 commit 1505d37

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

aml_tester/src/main.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use aml::{AmlContext, DebugVerbosity};
1313
use clap::{Arg, ArgAction, ArgGroup};
1414
use 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

Comments
 (0)