From 87b30a660494a92ba616294f14a56c2f33e59b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABlle=20van=20Essen?= Date: Thu, 13 Mar 2025 17:27:41 +0100 Subject: [PATCH] zoc: Default output type --- zoc/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zoc/src/main.rs b/zoc/src/main.rs index a07aadd..0f7b91e 100644 --- a/zoc/src/main.rs +++ b/zoc/src/main.rs @@ -26,10 +26,7 @@ pub struct Options { fn main() -> Result<(), Box> { let opts = options().run(); - let output_type = match opts.output_type { - Some(t) => t, - None => OutputType::Elf, - }; + let output_type = opts.output_type.unwrap_or_default(); match output_type { OutputType::LlvmIrLinked | OutputType::Assembly => todo!(), @@ -125,7 +122,7 @@ fn write_to_file(content: &[u8], path: &Path) -> io::Result<()> { Ok(()) } -#[derive(Bpaf, Clone, Copy, Debug, PartialEq)] +#[derive(Bpaf, Clone, Copy, Debug, Default, PartialEq)] enum OutputType { /// Produce pre-linked LLVM IR #[bpaf(long("ll"))] @@ -134,6 +131,7 @@ enum OutputType { #[bpaf(long("linked-ll"))] LlvmIrLinked, /// Produce ELF binary (default) + #[default] Elf, /// Produce assembly #[bpaf(long("asm"))]