From bded715627bc9ec798afc88cc7e64890c1de54f2 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Wed, 14 Sep 2022 22:55:45 +0200 Subject: [PATCH] "better" fmt --- src/opts.rs | 77 +++++++++++++---------------------------------------- 1 file changed, 19 insertions(+), 58 deletions(-) diff --git a/src/opts.rs b/src/opts.rs index 1a6b5b0..1051453 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -124,23 +124,13 @@ macro_rules! options { } options!( - fn alternate(&self) -> bool { - false - } - struct WithAlternate { - true - } + fn alternate(&self) -> bool { false } + struct WithAlternate { true } - fn width(&self) -> Option { - None - } - struct WithWidth { - Some(A) - } + fn width(&self) -> Option { None } + struct WithWidth { Some(A) } - fn align(&self) -> Alignment { - Alignment::Unknown - } + fn align(&self) -> Alignment { Alignment::Unknown } struct WithAlign { match A { 0 => Alignment::Unknown, @@ -151,53 +141,24 @@ options!( } } + fn fill(&self) -> char { ' ' } + struct WithFill { A } - fn fill(&self) -> char { - ' ' - } - struct WithFill { - A - } + fn sign_plus(&self) -> bool { false } + struct WithSignPlus { true } - fn sign_plus(&self) -> bool { - false - } - struct WithSignPlus { - true - } + fn sign_aware_zero_pad(&self) -> bool { false } + struct WithSignAwareZeroPad { true } - fn sign_aware_zero_pad(&self) -> bool { - false - } - struct WithSignAwareZeroPad { - true - } + fn sign_minus(&self) -> bool { false } + struct WithMinus { true } - fn sign_minus(&self) -> bool { - false - } - struct WithMinus { - true - } + fn precision(&self) -> Option { None } + struct WithPrecision { Some(A) } - fn precision(&self) -> Option { - None - } - struct WithPrecision { - Some(A) - } + fn debug_lower_hex(&self) -> bool { false } + struct WithDebugLowerHex { true } - fn debug_lower_hex(&self) -> bool { - false - } - struct WithDebugLowerHex { - true - } - - fn debug_upper_hex(&self) -> bool { - false - } - struct WithDebugUpperHex { - false - } + fn debug_upper_hex(&self) -> bool { false } + struct WithDebugUpperHex { false } );