summaryrefslogtreecommitdiff
path: root/rust/kernel/kunit.rs
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2025-08-13 11:39:51 -0400
committerMiguel Ojeda <ojeda@kernel.org>2025-09-16 09:26:59 +0200
commitaa2417c1a5842a1eb9b6b5dcf1a9ccb617583eb9 (patch)
treeb51c0f08f3a1e4b63a08c2a9bf8fd1cac6adc2f5 /rust/kernel/kunit.rs
parente6aedde22dc42d83280d63753309884de3c21da4 (diff)
rust: kunit: 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. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <lossin@kernel.org> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/kunit.rs')
-rw-r--r--rust/kernel/kunit.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/rust/kernel/kunit.rs b/rust/kernel/kunit.rs
index 41efd87595d6..cf58a204b222 100644
--- a/rust/kernel/kunit.rs
+++ b/rust/kernel/kunit.rs
@@ -6,8 +6,8 @@
//!
//! Reference: <https://docs.kernel.org/dev-tools/kunit/index.html>
+use crate::fmt;
use crate::prelude::*;
-use core::fmt;
#[cfg(CONFIG_PRINTK)]
use crate::c_str;
@@ -74,14 +74,14 @@ macro_rules! kunit_assert {
// mistake (it is hidden to prevent that).
//
// This mimics KUnit's failed assertion format.
- $crate::kunit::err(format_args!(
+ $crate::kunit::err($crate::prelude::fmt!(
" # {}: ASSERTION FAILED at {FILE}:{LINE}\n",
$name
));
- $crate::kunit::err(format_args!(
+ $crate::kunit::err($crate::prelude::fmt!(
" Expected {CONDITION} to be true, but is false\n"
));
- $crate::kunit::err(format_args!(
+ $crate::kunit::err($crate::prelude::fmt!(
" Failure not reported to KUnit since this is a non-KUnit task\n"
));
break 'out;