mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
use iterator change in expand_derive_strong_enum
This commit is contained in:
parent
8841f83e68
commit
62b591e63a
@ -118,17 +118,16 @@ fn expand_derive_decode_strong_enum(
|
||||
|
||||
let ident = &input.ident;
|
||||
|
||||
let mut value_arms = Vec::new();
|
||||
for v in variants {
|
||||
let value_arms = variants.iter().map(|v| -> Arm {
|
||||
let id = &v.ident;
|
||||
let attributes = parse_attributes(&v.attrs)?;
|
||||
let attributes = parse_attributes(&v.attrs).unwrap();
|
||||
if let Some(rename) = attributes.rename {
|
||||
value_arms.push(quote!(#rename => Ok(#ident :: #id),));
|
||||
parse_quote!(#rename => Ok(#ident :: #id),)
|
||||
} else {
|
||||
let name = id.to_string();
|
||||
value_arms.push(quote!(#name => Ok(#ident :: #id),));
|
||||
parse_quote!(#name => Ok(#ident :: #id),)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: prevent heap allocation
|
||||
Ok(quote!(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user