Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
refactor: use retain for error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Oppen committed Jul 31, 2023
1 parent cdf9880 commit f682898
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,9 @@ pub(crate) fn to_cairo_runner_program(
return Err(ProgramError::PrimeDiffers(program.prime.to_string()));
};

let error_message_attributes = serde_json::from_value::<Vec<Attribute>>(program.attributes)
.unwrap_or(Vec::new())
.into_iter()
.filter(|attr| attr.name == "error_message")
.collect();
let mut error_message_attributes =
serde_json::from_value::<Vec<Attribute>>(program.attributes).unwrap_or_default();
error_message_attributes.retain(|attr| attr.name == "error_message");

let program = Program::new(
serde_json::from_value::<Vec<BuiltinName>>(program.builtins)?,
Expand Down

0 comments on commit f682898

Please sign in to comment.