From be5c1c8fe0ec45dd7aa9b027bb1a2d0f6a8e790f Mon Sep 17 00:00:00 2001 From: Marquess Valdez Date: Mon, 25 Mar 2024 14:14:13 -0700 Subject: [PATCH] break up setstate method --- rust/src/instruction/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/src/instruction/mod.rs b/rust/src/instruction/mod.rs index 6be8e1217..16e9ab981 100644 --- a/rust/src/instruction/mod.rs +++ b/rust/src/instruction/mod.rs @@ -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(); @@ -135,7 +135,7 @@ impl Instruction { inner: instructions .into_iter() .next() - .expect("Instructions has exactly one instruction."), + .expect("instructions has exactly one instruction."), }; Ok(())