Skip to content

Commit

Permalink
Update src/core/response/parameters.rs
Browse files Browse the repository at this point in the history
Co-authored-by: Jacob <[email protected]>
  • Loading branch information
Ryanmtate and cobward authored Sep 24, 2024
1 parent 7f0895c commit 96934c9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/core/response/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ impl TryFrom<Json> 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::<Result<Vec<Self>, Self::Error>>()
.map(Self::Many)
}
_ => Err(Error::msg("Invalid vp_token")),
}
Expand Down

0 comments on commit 96934c9

Please sign in to comment.