diff options
author | Tamir Duberstein <tamird@gmail.com> | 2025-07-04 16:14:54 -0400 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2025-07-21 01:16:35 +0200 |
commit | 386f285d885ae40b64ccf8328d59694055af3187 (patch) | |
tree | 2fea8e1dbe2a3c23e7db38c67d61d98c4d2f952b /rust/kernel/print.rs | |
parent | bda947d613f1882c73ebb3ddda388459bab5902c (diff) |
rust: use `kernel::{fmt,prelude::fmt!}`
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@gmail.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20250704-core-cstr-prepare-v1-3-a91524037783@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/print.rs')
-rw-r--r-- | rust/kernel/print.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/kernel/print.rs b/rust/kernel/print.rs index ecdcee43e5a5..2d743d78d220 100644 --- a/rust/kernel/print.rs +++ b/rust/kernel/print.rs @@ -8,10 +8,10 @@ use crate::{ ffi::{c_char, c_void}, + fmt, prelude::*, str::RawFormatter, }; -use core::fmt; // Called from `vsprintf` with format specifier `%pA`. #[expect(clippy::missing_safety_doc)] @@ -149,7 +149,7 @@ macro_rules! print_macro ( // takes borrows on the arguments, but does not extend the scope of temporaries. // Therefore, a `match` expression is used to keep them around, since // the scrutinee is kept until the end of the `match`. - match format_args!($($arg)+) { + match $crate::prelude::fmt!($($arg)+) { // SAFETY: This hidden macro should only be called by the documented // printing macros which ensure the format string is one of the fixed // ones. All `__LOG_PREFIX`s are null-terminated as they are generated @@ -168,7 +168,7 @@ macro_rules! print_macro ( // The `CONT` case. ($format_string:path, true, $($arg:tt)+) => ( $crate::print::call_printk_cont( - format_args!($($arg)+), + $crate::prelude::fmt!($($arg)+), ); ); ); |