From c894a25c99790c2562fd40ceb2808677578881b7 Mon Sep 17 00:00:00 2001 From: Richard Chien <stdrc@outlook.com> Date: Wed, 10 Jan 2024 12:53:15 +0800 Subject: [PATCH] auto impl Display for FrameExclusion Signed-off-by: Richard Chien <stdrc@outlook.com> --- src/expr/core/src/window_function/call.rs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/expr/core/src/window_function/call.rs b/src/expr/core/src/window_function/call.rs index a7804be77725c..43545cc2a107a 100644 --- a/src/expr/core/src/window_function/call.rs +++ b/src/expr/core/src/window_function/call.rs @@ -245,7 +245,8 @@ impl FrameBound<usize> { } } -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default, EnumAsInner)] +#[derive(Display, Debug, Copy, Clone, Eq, PartialEq, Hash, Default, EnumAsInner)] +#[display("EXCLUDE {}", style = "TITLE CASE")] pub enum FrameExclusion { CurrentRow, // Group, @@ -254,16 +255,6 @@ pub enum FrameExclusion { NoOthers, } -impl Display for FrameExclusion { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - FrameExclusion::CurrentRow => write!(f, "EXCLUDE CURRENT ROW")?, - FrameExclusion::NoOthers => write!(f, "EXCLUDE NO OTHERS")?, - } - Ok(()) - } -} - impl FrameExclusion { pub fn from_protobuf(exclusion: PbExclusion) -> Result<Self> { let excl = match exclusion {