Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Dec 6, 2023
1 parent 51207f4 commit 7230a17
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions macro/src/dialect/operation/accessors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,16 @@ impl<'a> OperationField<'a> {
}

fn remover_impl(&self) -> Result<Option<TokenStream>, 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
})
}

Expand Down

0 comments on commit 7230a17

Please sign in to comment.