[PATCH 7/9] rust: pin-init: use `kernel::{fmt,prelude::fmt!}`

Tamir Duberstein tamird at gmail.com
Wed Jul 9 20:00:06 UTC 2025


Reduce coupling to implementation details of the formatting machinery by
avoiding direct use for `core`'s formatting traits and macros.

Acked-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl at google.com>
Signed-off-by: Tamir Duberstein <tamird at gmail.com>
---
 rust/kernel/init.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs
index 8d228c237954..aa3fc90d32d1 100644
--- a/rust/kernel/init.rs
+++ b/rust/kernel/init.rs
@@ -68,7 +68,7 @@
 //!
 //! ```rust,ignore
 //! # #![allow(unreachable_pub, clippy::disallowed_names)]
-//! use kernel::{prelude::*, types::Opaque};
+//! use kernel::{fmt, prelude::*, types::Opaque};
 //! use core::{ptr::addr_of_mut, marker::PhantomPinned, pin::Pin};
 //! # mod bindings {
 //! #     #![allow(non_camel_case_types)]
@@ -81,7 +81,7 @@
 //! # trait FromErrno {
 //! #     fn from_errno(errno: core::ffi::c_int) -> Error {
 //! #         // Dummy error that can be constructed outside the `kernel` crate.
-//! #         Error::from(core::fmt::Error)
+//! #         Error::from(fmt::Error)
 //! #     }
 //! # }
 //! # impl FromErrno for Error {}

-- 
2.50.0



More information about the dri-devel mailing list