Add a `Debug` implementation for `StoreError` to enable better error reporting and debugging. The implementation only displays the `error` field and omits the `value` field, as `T` may not implement `Debug`. Reviewed-by: Gary Guo Reviewed-by: Daniel Gomez Acked-by: Tamir Duberstein Acked-by: Liam R. Howlett Signed-off-by: Andreas Hindborg --- rust/kernel/xarray.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rust/kernel/xarray.rs b/rust/kernel/xarray.rs index b80fb7a262d0..d54942aeb201 100644 --- a/rust/kernel/xarray.rs +++ b/rust/kernel/xarray.rs @@ -193,6 +193,14 @@ pub struct StoreError { pub value: T, } +impl kernel::fmt::Debug for StoreError { + fn fmt(&self, f: &mut kernel::fmt::Formatter<'_>) -> kernel::fmt::Result { + f.debug_struct("StoreError") + .field("error", &self.error) + .finish() + } +} + impl From> for Error { #[inline] fn from(value: StoreError) -> Self { -- 2.51.2