Skip to content

Commit

Permalink
Clean up by replacing if-else block with match expression
Browse files Browse the repository at this point in the history
  • Loading branch information
conr2d committed Oct 31, 2024
1 parent ca60480 commit 035dc3e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ impl TypeInfoImpl {
} else {
quote!(ty)
};
let name = if let Some(ident) = utils::maybe_renamed(f) {
quote!(.name(#ident))
} else if let Some(ident) = ident {
quote!(.name(::core::stringify!(#ident)))
} else {
quote!()
let name = match utils::maybe_renamed(f) {
Some(ident) => quote!(.name(#ident)),
None => ident
.as_ref()
.map(|ident| quote!(.name(::core::stringify!(#ident))))
.unwrap_or(quote!()),
};
quote!(
.field(|f| f
Expand Down

0 comments on commit 035dc3e

Please sign in to comment.