Re: [PATCH] rust: str: make NullTerminatedFormatter public
From: Andreas Hindborg
Date: Tue Feb 24 2026 - 06:34:33 EST
"Alexandre Courbot" <acourbot@xxxxxxxxxx> writes:
> If `CONFIG_BLOCK` is disabled, the following warnings are displayed
> during build:
>
> warning: struct `NullTerminatedFormatter` is never constructed
> --> ../rust/kernel/str.rs:667:19
> |
> 667 | pub(crate) struct NullTerminatedFormatter<'a> {
> | ^^^^^^^^^^^^^^^^^^^^^^^
> |
> = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default
>
> warning: associated function `new` is never used
> --> ../rust/kernel/str.rs:673:19
> |
> 671 | impl<'a> NullTerminatedFormatter<'a> {
> | ------------------------------------ associated function in this implementation
> 672 | /// Create a new [`Self`] instance.
> 673 | pub(crate) fn new(buffer: &'a mut [u8]) -> Option<NullTerminatedFormatter<'a>> {
>
> Fix them by making `NullTerminatedFormatter` public, as it could be
> useful for drivers anyway.
>
> Fixes: cdde7a1951ff ("rust: str: introduce `NullTerminatedFormatter`")
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
Reviewed-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
Best regards,
Andreas Hindborg