From 6ed35f4674485c62a5a0f50d231fcb2e867fb03a Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 30 Sep 2023 00:16:19 -0400 Subject: [PATCH] Minor cleanup. --- src/compare/compare.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compare/compare.rs b/src/compare/compare.rs index 9168155d..f77c8088 100644 --- a/src/compare/compare.rs +++ b/src/compare/compare.rs @@ -28,8 +28,7 @@ pub fn run_anonymous_compare_with_settings>( // TODO: This is a work-around to pretend that dos line endings do not exist. It would be better to handle the difference in line endings. let org_contents = org_contents.as_ref().replace("\r\n", "\n"); let org_contents = org_contents.as_str(); - eprintln!("Using emacs version: {}", get_emacs_version()?.trim()); - eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim()); + print_versions()?; let rust_parsed = parse_with_settings(org_contents, global_settings)?; let org_sexp = emacs_parse_anonymous_org_document(org_contents, global_settings)?; let (_remaining, parsed_sexp) = sexp(org_sexp.as_str()).map_err(|e| e.to_string())?; @@ -54,8 +53,7 @@ pub fn run_compare_on_file_with_settings>( global_settings: &GlobalSettings, ) -> Result<(), Box> { let org_path = org_path.as_ref(); - eprintln!("Using emacs version: {}", get_emacs_version()?.trim()); - eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim()); + print_versions()?; let parent_directory = org_path .parent() .ok_or("Should be contained inside a directory.")?; @@ -89,3 +87,9 @@ pub fn run_compare_on_file_with_settings>( Ok(()) } + +fn print_versions() -> Result<(), Box> { + eprintln!("Using emacs version: {}", get_emacs_version()?.trim()); + eprintln!("Using org-mode version: {}", get_org_mode_version()?.trim()); + Ok(()) +}