summaryrefslogtreecommitdiff
path: root/rust/kernel/str.rs
diff options
context:
space:
mode:
authorAndreas Hindborg <a.hindborg@kernel.org>2025-09-02 11:55:02 +0200
committerJens Axboe <axboe@kernel.dk>2025-09-02 05:23:56 -0600
commitc3a54220b54a1bda0662f0e7ab90ffabf5036d50 (patch)
tree9c7f998428b5767c7f857678e886a24e4ec15eec /rust/kernel/str.rs
parentf4b72f1558be1e2b173b6b1f93c09dc668592a26 (diff)
rust: block: use `NullTerminatedFormatter`
Use the new `NullTerminatedFormatter` to write the name of a `GenDisk` to the name buffer. This new formatter automatically adds a trailing null marker after the written characters, so we don't need to append that at the call site any longer. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20250902-rnull-up-v6-16-v7-8-b5212cc89b98@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'rust/kernel/str.rs')
-rw-r--r--rust/kernel/str.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs
index d2f9ebc94b75..5c74e5f77601 100644
--- a/rust/kernel/str.rs
+++ b/rust/kernel/str.rs
@@ -886,7 +886,6 @@ pub(crate) struct NullTerminatedFormatter<'a> {
impl<'a> NullTerminatedFormatter<'a> {
/// Create a new [`Self`] instance.
- #[expect(dead_code)]
pub(crate) fn new(buffer: &'a mut [u8]) -> Option<NullTerminatedFormatter<'a>> {
*(buffer.first_mut()?) = 0;