diff --git a/rust/fastsim-core/src/imports.rs b/rust/fastsim-core/src/imports.rs index e48aceb1..5eab968e 100644 --- a/rust/fastsim-core/src/imports.rs +++ b/rust/fastsim-core/src/imports.rs @@ -1,4 +1,4 @@ -pub(crate) use anyhow; +pub(crate) use anyhow::{self, Context}; pub(crate) use bincode; pub(crate) use log; pub(crate) use ndarray::{array, concatenate, s, Array, Array1, Axis}; diff --git a/rust/fastsim-core/src/simdrive/simdrive_iter.rs b/rust/fastsim-core/src/simdrive/simdrive_iter.rs index 737048ce..98c5e88a 100644 --- a/rust/fastsim-core/src/simdrive/simdrive_iter.rs +++ b/rust/fastsim-core/src/simdrive/simdrive_iter.rs @@ -49,12 +49,12 @@ impl SimDriveVec { if parallelize { self.0.par_iter_mut().enumerate().try_for_each(|(i, sd)| { sd.sim_drive(None, None) - .map_err(|err| err.context(format!("simdrive idx:{}", i))) + .with_context(|| format!("simdrive idx: {}", i)) })?; } else { self.0.iter_mut().enumerate().try_for_each(|(i, sd)| { sd.sim_drive(None, None) - .map_err(|err| err.context(format!("simdrive idx:{}", i))) + .with_context(|| format!("simdrive idx: {}", i)) })?; } Ok(())