From 7230a174fe6507171d74449cd14ac0a1469a34dc Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Wed, 6 Dec 2023 09:49:05 +0900 Subject: [PATCH] Refactor --- macro/src/dialect/operation/accessors.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/macro/src/dialect/operation/accessors.rs b/macro/src/dialect/operation/accessors.rs index ac870bc86a..dfefd6f054 100644 --- a/macro/src/dialect/operation/accessors.rs +++ b/macro/src/dialect/operation/accessors.rs @@ -160,19 +160,16 @@ impl<'a> OperationField<'a> { } fn remover_impl(&self) -> Result, Error> { - Ok(match &self.kind { - FieldKind::Attribute { constraint } => { + Ok(if let FieldKind::Attribute { constraint } = &self.kind { + if constraint.is_unit()? || constraint.is_optional()? { let name = &self.name; - if constraint.is_unit()? || constraint.is_optional()? { - Some(quote! { - self.operation.remove_attribute(#name) - }) - } else { - None - } + Some(quote! { self.operation.remove_attribute(#name) }) + } else { + None } - _ => None, + } else { + None }) }