diff --git a/src/main.rs b/src/main.rs index 6d22775..89ed0b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -498,6 +498,16 @@ fn main() -> Result<(), Box> { .to_string(), ); + fn print_missing_ids(missing_ids: &[&String], term: &Term) { + missing_ids.iter().sorted().for_each(|&item| { + let _ = term.write_line(&format!( + "{} ({})", + item, + to_database_id(item).unwrap_or("?".into()) + )); + }); + } + if db_meldungen.len() != xml_meldungen.len() { let _ = term.write_line( &style("\nNicht übereinstimmende Anzahl an Meldungen:") @@ -522,13 +532,7 @@ fn main() -> Result<(), Box> { .to_string(), ); - missing_db_ids.iter().sorted().for_each(|&item| { - let _ = term.write_line(&format!( - "{} ({})", - item, - to_database_id(item).unwrap_or("?".into()) - )); - }); + print_missing_ids(&missing_db_ids, &term); } if !missing_xml_ids.is_empty() { @@ -538,13 +542,7 @@ fn main() -> Result<(), Box> { .to_string(), ); - missing_xml_ids.iter().sorted().for_each(|&item| { - let _ = term.write_line(&format!( - "{} ({})", - item, - to_database_id(item).unwrap_or("?".into()) - )); - }); + print_missing_ids(&missing_xml_ids, &term); } }