]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
rust: alloc: use `kernel::{fmt,prelude::fmt!}`
authorTamir Duberstein <tamird@gmail.com>
Wed, 13 Aug 2025 15:39:47 +0000 (11:39 -0400)
committerMiguel Ojeda <ojeda@kernel.org>
Tue, 16 Sep 2025 07:26:58 +0000 (09:26 +0200)
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>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/alloc/kbox.rs
rust/kernel/alloc/kvec.rs
rust/kernel/alloc/kvec/errors.rs

index 1aa83d751f10d37cbd289e33bbde68229dd4a3c5..27c4b5a9b61dc55c82d10a2a07f53e29a77bebe4 100644 (file)
@@ -7,7 +7,6 @@ use super::allocator::{KVmalloc, Kmalloc, Vmalloc};
 use super::{AllocError, Allocator, Flags};
 use core::alloc::Layout;
 use core::borrow::{Borrow, BorrowMut};
-use core::fmt;
 use core::marker::PhantomData;
 use core::mem::ManuallyDrop;
 use core::mem::MaybeUninit;
@@ -17,6 +16,7 @@ use core::ptr::NonNull;
 use core::result::Result;
 
 use crate::ffi::c_void;
+use crate::fmt;
 use crate::init::InPlaceInit;
 use crate::types::ForeignOwnable;
 use pin_init::{InPlaceWrite, Init, PinInit, ZeroableOption};
index d42dbdc44f0fd561a1aff8a4e09e998a191a311d..dfc101e03f358a70d73a9acce1257ee0e1f6486c 100644 (file)
@@ -7,9 +7,9 @@ use super::{
     layout::ArrayLayout,
     AllocError, Allocator, Box, Flags,
 };
+use crate::fmt;
 use core::{
     borrow::{Borrow, BorrowMut},
-    fmt,
     marker::PhantomData,
     mem::{ManuallyDrop, MaybeUninit},
     ops::Deref,
index 348b8d27e102ca34a0d6194ae9d00b12c11547b4..21a920a4b09bc19381ee739edc6ab09475c7913b 100644 (file)
@@ -2,7 +2,7 @@
 
 //! Errors for the [`Vec`] type.
 
-use core::fmt::{self, Debug, Formatter};
+use kernel::fmt::{self, Debug, Formatter};
 use kernel::prelude::*;
 
 /// Error type for [`Vec::push_within_capacity`].