From 725891d1b6b8a3cbe670cf086679de80233db4c7 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Sun, 24 Aug 2025 14:40:38 +0200 Subject: [PATCH] refactor: simplify output format determination logic in main function --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index d798d8d..ccdd19a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -50,11 +50,10 @@ fn main() -> Result<()> { let mut format = args.format; if matches!(format, Format::Console) { if let Some(output_path) = &args.output { - if output_path.extension().and_then(|s| s.to_str()) == Some("md") { - format = Format::Markdown; - } - if output_path.extension().and_then(|s| s.to_str()) == Some("txt") { - format = Format::Text; + match output_path.extension().and_then(|s| s.to_str()) { + Some("md") => format = Format::Markdown, + Some("txt") => format = Format::Text, + _ => {} } } }