From 6a4c33bb1fefcbc923b67b80a1f0604162245a04 Mon Sep 17 00:00:00 2001 From: Richard Chien Date: Wed, 10 Jan 2024 12:53:15 +0800 Subject: [PATCH] auto impl Display for FrameExclusion Signed-off-by: Richard Chien --- 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 { } } -#[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 { let excl = match exclusion {