From 3fad06a32b46261089246c4b04c12434a08aa1a2 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 {