Skip to content
Snippets Groups Projects
Commit 0664e21e authored by Kivimango's avatar Kivimango
Browse files

clippy: Fix unnecessary unwrap()

parent 6d245b26
No related branches found
No related tags found
1 merge request!297Silence compiler warnings and clippy fixes
......@@ -4,16 +4,21 @@ use std::process::exit;
// use clap::Parser;
fn main() {
let result = list_recipes( Path::new("recipes"));
if result.is_err() {
eprintln!("{}", result.err().unwrap());
exit(2);
} else if result.as_ref().unwrap().is_empty() {
eprintln!("recipes not found");
exit(1);
} else {
result.unwrap().iter().for_each(|recipe| println!("{}", recipe));
exit(0);
match result {
Ok(result) => {
if result.is_empty() {
eprintln!("recipes not found");
exit(1);
} else {
result.iter().for_each(|recipe| println!("{recipe}"));
exit(0);
}
}
Err(error) => {
eprintln!("{error}");
exit(2);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment