Re: [PATCH v3 02/12] rust: xarray: add debug format for `StoreError`
From: Liam R. Howlett
Date: Tue Feb 10 2026 - 12:46:46 EST
* Andreas Hindborg <a.hindborg@xxxxxxxxxx> [260209 14:39]:
> Add a `Debug` implementation for `StoreError<T>` 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 <gary@xxxxxxxxxxx>
> Acked-by: Tamir Duberstein <tamird@xxxxxxxxx>
> Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
Acked-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
> ---
> rust/kernel/xarray.rs | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/rust/kernel/xarray.rs b/rust/kernel/xarray.rs
> index 88625c9abf4ef..d9762c6bef19c 100644
> --- a/rust/kernel/xarray.rs
> +++ b/rust/kernel/xarray.rs
> @@ -193,6 +193,14 @@ pub struct StoreError<T> {
> pub value: T,
> }
>
> +impl<T> core::fmt::Debug for StoreError<T> {
> + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
> + f.debug_struct("StoreError")
> + .field("error", &self.error)
> + .finish()
> + }
> +}
> +
> impl<T> From<StoreError<T>> for Error {
> fn from(value: StoreError<T>) -> Self {
> value.error
>
> --
> 2.51.2
>
>
>