Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: alloc: 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 9def0d0a2a1c ("rust: alloc: add
Vec::push_within_capacity").

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20251018-cstr-core-v18-6-9378a54385f8@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Tamir Duberstein and committed by
Miguel Ojeda
b0af4f91 5cc5d805

+7 -7
+7 -7
rust/kernel/alloc/kvec/errors.rs
··· 2 2 3 3 //! Errors for the [`Vec`] type. 4 4 5 - use kernel::fmt::{self, Debug, Formatter}; 5 + use kernel::fmt; 6 6 use kernel::prelude::*; 7 7 8 8 /// Error type for [`Vec::push_within_capacity`]. 9 9 pub struct PushError<T>(pub T); 10 10 11 - impl<T> Debug for PushError<T> { 12 - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { 11 + impl<T> fmt::Debug for PushError<T> { 12 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 13 13 write!(f, "Not enough capacity") 14 14 } 15 15 } ··· 25 25 /// Error type for [`Vec::remove`]. 26 26 pub struct RemoveError; 27 27 28 - impl Debug for RemoveError { 29 - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { 28 + impl fmt::Debug for RemoveError { 29 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 30 30 write!(f, "Index out of bounds") 31 31 } 32 32 } ··· 45 45 OutOfCapacity(T), 46 46 } 47 47 48 - impl<T> Debug for InsertError<T> { 49 - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { 48 + impl<T> fmt::Debug for InsertError<T> { 49 + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 50 50 match self { 51 51 InsertError::IndexOutOfBounds(_) => write!(f, "Index out of bounds"), 52 52 InsertError::OutOfCapacity(_) => write!(f, "Not enough capacity"),