mirror of
https://git.proxmox.com/git/proxmox
synced 2025-10-04 21:25:17 +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,
|
span: obj.brace_token.span,
|
||||||
description,
|
description,
|
||||||
item: SchemaItem::try_extract_from(&mut obj)?,
|
item: SchemaItem::try_extract_from(&mut obj)?,
|
||||||
properties: obj.into_iter().try_fold(
|
properties: obj
|
||||||
Vec::new(),
|
.into_iter()
|
||||||
|mut properties, (key, value)| -> Result<_, syn::Error> {
|
.map(|(key, value)| Ok((key.into_ident(), value.try_into()?)))
|
||||||
properties.push((key.into_ident(), value.try_into()?));
|
.collect::<Result<_, syn::Error>>()?,
|
||||||
Ok(properties)
|
|
||||||
},
|
|
||||||
)?,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user