Re: [PATCH v3 9/9] rust: device: use `kernel::{fmt,prelude::fmt!}`
From: Tamir Duberstein
Date: Tue Sep 23 2025 - 21:09:31 EST
On Thu, Aug 14, 2025 at 4:54 PM Benno Lossin <lossin@xxxxxxxxxx> wrote:
>
> On Wed Aug 13, 2025 at 5:39 PM CEST, Tamir Duberstein wrote:
> > Reduce coupling to implementation details of the formatting machinery by
> > avoiding direct use for `core`'s formatting traits and macros.
> >
> > Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
>
> Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>
>
> > ---
> > rust/kernel/device/property.rs | 23 ++++++++++++-----------
> > 1 file changed, 12 insertions(+), 11 deletions(-)
>
> > @@ -413,9 +414,9 @@ fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
> > // SAFETY: `fwnode_get_name_prefix` returns null or a
> > // valid C string.
> > let prefix = unsafe { CStr::from_char_ptr(prefix) };
> > - write!(f, "{prefix}")?;
> > + fmt::Display::fmt(prefix, f)?;
> > }
> > - write!(f, "{}", fwnode.display_name())?;
>
> So we're not able to use `write!` with our `Display` or did you also
> write a `FmtAdapter` wrapper for that? (don't think we need it now, just
> wanted to know if we have this issue possibly in the future)
Correct; we cannot use `write!` with our `Display`.
Apologies for the late reply - I had sent this back in August but was
still being throttled by gmail :(