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 Reviewed-by: Daniel Almeida Signed-off-by: Andreas Hindborg --- rust/kernel/xarray.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rust/kernel/xarray.rs b/rust/kernel/xarray.rs index 4f4b6bf5750d..19581b9dfe9e 100644 --- a/rust/kernel/xarray.rs +++ b/rust/kernel/xarray.rs @@ -19,6 +19,7 @@ Result, // }, ffi::c_void, + fmt, types::{ ForeignOwnable, NotThreadSafe, @@ -193,6 +194,15 @@ pub struct StoreError { pub value: T, } +impl fmt::Debug for StoreError { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("StoreError") + .field("error", &self.error) + .finish() + } +} + impl From> for Error { #[inline] fn from(value: StoreError) -> Self { -- 2.54.0