mirror of
https://git.proxmox.com/git/proxmox
synced 2025-10-04 18:25:05 +00:00
api-macro: cleanup: don't use try_fold for a Vec
`collect()` uses `FromIterator` which is also implemented for `Result<Vec, Err>` from `Result<Item, Err>` doing the same thing. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
2edd8da965
commit
8e1ace59b1
@ -105,13 +105,10 @@ impl TryFrom<JSONObject> for Schema {
|
||||
span: obj.brace_token.span,
|
||||
description,
|
||||
item: SchemaItem::try_extract_from(&mut obj)?,
|
||||
properties: obj.into_iter().try_fold(
|
||||
Vec::new(),
|
||||
|mut properties, (key, value)| -> Result<_, syn::Error> {
|
||||
properties.push((key.into_ident(), value.try_into()?));
|
||||
Ok(properties)
|
||||
},
|
||||
)?,
|
||||
properties: obj
|
||||
.into_iter()
|
||||
.map(|(key, value)| Ok((key.into_ident(), value.try_into()?)))
|
||||
.collect::<Result<_, syn::Error>>()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user