From 96934c925490f0ac08d7fd0f6de2f091512ffc4f Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Tue, 24 Sep 2024 08:23:45 -0700 Subject: [PATCH] Update src/core/response/parameters.rs Co-authored-by: Jacob --- src/core/response/parameters.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/core/response/parameters.rs b/src/core/response/parameters.rs index ed2e56d..44cbf42 100644 --- a/src/core/response/parameters.rs +++ b/src/core/response/parameters.rs @@ -65,11 +65,10 @@ impl TryFrom for VpToken { // NOTE: When the Json is an object, it must be a map. Json::Object(map) => Ok(Self::SingleAsMap(map)), Json::Array(arr) => { - let mut tokens = Vec::new(); - for value in arr { - tokens.push(Self::try_from(value)?); - } - Ok(Self::Many(tokens)) + arr.into_iter() + .map(Self::try_from) + .collect::, Self::Error>>() + .map(Self::Many) } _ => Err(Error::msg("Invalid vp_token")), }