From 3f0dd5fad9ac275648bd7407f032a8b7adaf204f Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Sat, 18 Oct 2025 15:16:28 -0400 Subject: rust: debugfs: use `kernel::fmt` Reduce coupling to implementation details of the formatting machinery by avoiding direct use for `core`'s formatting traits and macros. This backslid in commit 40ecc49466c8 ("rust: debugfs: Add support for callback-based files") and commit 5e40b591cb46 ("rust: debugfs: Add support for read-only files"). Acked-by: Danilo Krummrich Reviewed-by: Matthew Maurer Signed-off-by: Tamir Duberstein Link: https://patch.msgid.link/20251018-cstr-core-v18-7-9378a54385f8@gmail.com Signed-off-by: Miguel Ojeda --- rust/kernel/debugfs/callback_adapters.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'rust/kernel/debugfs/callback_adapters.rs') diff --git a/rust/kernel/debugfs/callback_adapters.rs b/rust/kernel/debugfs/callback_adapters.rs index 6c024230f676..a260d8dee051 100644 --- a/rust/kernel/debugfs/callback_adapters.rs +++ b/rust/kernel/debugfs/callback_adapters.rs @@ -5,10 +5,9 @@ //! than a trait implementation. If provided, it will override the trait implementation. use super::{Reader, Writer}; +use crate::fmt; use crate::prelude::*; use crate::uaccess::UserSliceReader; -use core::fmt; -use core::fmt::Formatter; use core::marker::PhantomData; use core::ops::Deref; @@ -76,9 +75,9 @@ impl Deref for FormatAdapter { impl Writer for FormatAdapter where - F: Fn(&D, &mut Formatter<'_>) -> fmt::Result + 'static, + F: Fn(&D, &mut fmt::Formatter<'_>) -> fmt::Result + 'static, { - fn write(&self, fmt: &mut Formatter<'_>) -> fmt::Result { + fn write(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { // SAFETY: FormatAdapter<_, F> can only be constructed if F is inhabited let f: &F = unsafe { materialize_zst() }; f(&self.inner, fmt) -- cgit v1.2.3