[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ-ks9k5=jGFWRsTmHbsvzJF3YTYzbDTQ43-uUNe8gaZfsnc8w@mail.gmail.com>
Date: Tue, 10 Feb 2026 11:55:17 -0500
From: Tamir Duberstein <tamird@...il.com>
To: Daniel Gomez <da.gomez@...nel.org>
Cc: Andreas Hindborg <a.hindborg@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, Danilo Krummrich <dakr@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...two.org>, David Rientjes <rientjes@...gle.com>,
Roman Gushchin <roman.gushchin@...ux.dev>, Harry Yoo <harry.yoo@...cle.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH v3 02/12] rust: xarray: add debug format for `StoreError`
On Tue, Feb 10, 2026 at 8:45 AM Daniel Gomez <da.gomez@...nel.org> wrote:
>
> On 2026-02-09 15:38, Andreas Hindborg wrote:
> > 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@...yguo.net>
> > Acked-by: Tamir Duberstein <tamird@...il.com>
> > Signed-off-by: Andreas Hindborg <a.hindborg@...nel.org>
> > ---
> > 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()
> > + }
> > +}
> > +
>
> Is there any best practice for when to include use core::fmt::*, so you can
> avoid being verbose here?
>
> I see other cases like this, but I couldn't find anything in the code
> guidelines.
It would probably be better to use kernel::fmt::* rather than
core::fmt so that we can interpose our own trait in the future, if we
want.
Powered by blists - more mailing lists