From 8e1ace59b1cedf742f6597f6ab8c8ca9837c92fe Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 6 Mar 2020 13:37:59 +0100 Subject: [PATCH] api-macro: cleanup: don't use try_fold for a Vec `collect()` uses `FromIterator` which is also implemented for `Result` from `Result` doing the same thing. Signed-off-by: Wolfgang Bumiller --- proxmox-api-macro/src/api.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/proxmox-api-macro/src/api.rs b/proxmox-api-macro/src/api.rs index f3ca9571..bf8360ca 100644 --- a/proxmox-api-macro/src/api.rs +++ b/proxmox-api-macro/src/api.rs @@ -105,13 +105,10 @@ impl TryFrom 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::>()?, }) } }