refactor: remove voiding of return values when calling functions
+ properly handle errors for individual files SUGGESTIONS BY AI
This commit is contained in:
+7
-3
@@ -51,12 +51,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
continue;
|
||||
}
|
||||
let tag = get_metadata(&path);
|
||||
let _ = move_files(path, tag.clone(), extra_files.clone(), *copy);
|
||||
if let Err(e) =
|
||||
move_files(path.clone(), tag.clone(), extra_files.clone(), *copy)
|
||||
{
|
||||
eprintln!("Failed to import {:?}: {}", path, e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println!("Importing file: {:?}", file);
|
||||
let tag = get_metadata(file);
|
||||
let _ = move_files(file.clone(), tag.clone(), extra_files, *copy);
|
||||
move_files(file.clone(), tag.clone(), extra_files, *copy)?;
|
||||
}
|
||||
}
|
||||
Commands::Show { file } => {
|
||||
@@ -70,7 +74,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
Commands::Edit { file } => {
|
||||
let path = PathBuf::from("/tmp/keks-sort-metadata");
|
||||
let tag = get_metadata(file);
|
||||
let _ = edit(path, tag);
|
||||
edit(path, tag)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user