Skip to content

Commit

Permalink
break up setstate method
Browse files Browse the repository at this point in the history
  • Loading branch information
MarquessV committed Mar 25, 2024
1 parent 9258898 commit be5c1c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions rust/src/instruction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ impl Instruction {
_py: Python<'a>,
state: &Bound<'a, PyBytes>,
) -> PyResult<()> {
let instructions =
quil_rs::program::Program::from_str(std::str::from_utf8(state.as_bytes()).map_err(
|e| PyValueError::new_err(format!("Could not deserialize non-utf-8 string: {}", e)),
)?)
let program_str = std::str::from_utf8(state.as_bytes()).map_err(|e| {
PyValueError::new_err(format!("Could not deserialize non-utf-8 string: {}", e))
})?;
let instructions = quil_rs::program::Program::from_str(program_str)
.map_err(|e| PyRuntimeError::new_err(format!("Could not deserialize {}", e)))?
.into_instructions();

Expand All @@ -135,7 +135,7 @@ impl Instruction {
inner: instructions
.into_iter()
.next()
.expect("Instructions has exactly one instruction."),
.expect("instructions has exactly one instruction."),
};

Ok(())
Expand Down

0 comments on commit be5c1c8

Please sign in to comment.