]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: alloc: cleanup doctest imports to "kernel vertical" style
authorDanilo Krummrich <dakr@kernel.org>
Wed, 13 May 2026 19:09:16 +0000 (21:09 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Wed, 20 May 2026 15:34:17 +0000 (17:34 +0200)
Change all imports in the alloc module's doctests to use the "kernel
vertical" import style [1].

While at it, drop imports that are automatically included in doctests.

Link: https://docs.kernel.org/rust/coding-guidelines.html#imports
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
Link: https://patch.msgid.link/20260513190946.619810-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/alloc/allocator.rs
rust/kernel/alloc/kbox.rs
rust/kernel/alloc/kvec.rs
rust/kernel/alloc/layout.rs

index af20332d59f768acbec03e98772c680bda100596..562e41925ada533b0d443b3e7e9ad2fca740a773 100644 (file)
@@ -174,8 +174,11 @@ impl Vmalloc {
     /// # Examples
     ///
     /// ```
-    /// # use core::ptr::{NonNull, from_mut};
-    /// # use kernel::{page, prelude::*};
+    /// # use core::ptr::{
+    /// #     from_mut,
+    /// #     NonNull, //
+    /// # };
+    /// # use kernel::page;
     /// use kernel::alloc::allocator::Vmalloc;
     ///
     /// let mut vbox = VBox::<[u8; page::PAGE_SIZE]>::new_uninit(GFP_KERNEL)?;
index b8097dec3869ac056d33eca3705ccf8af0279e57..31b2588ed5bf96a69ed2529bb9fe158121954fb2 100644 (file)
@@ -297,7 +297,10 @@ where
     /// # Examples
     ///
     /// ```
-    /// use kernel::sync::{new_spinlock, SpinLock};
+    /// use kernel::sync::{
+    ///     new_spinlock,
+    ///     SpinLock, //
+    /// };
     ///
     /// struct Inner {
     ///     a: u32,
@@ -590,7 +593,6 @@ where
 ///
 /// ```
 /// # use core::borrow::Borrow;
-/// # use kernel::alloc::KBox;
 /// struct Foo<B: Borrow<u32>>(B);
 ///
 /// // Owned instance.
@@ -618,7 +620,6 @@ where
 ///
 /// ```
 /// # use core::borrow::BorrowMut;
-/// # use kernel::alloc::KBox;
 /// struct Foo<B: BorrowMut<u32>>(B);
 ///
 /// // Owned instance.
@@ -683,9 +684,13 @@ where
 /// # Examples
 ///
 /// ```
-/// # use kernel::prelude::*;
-/// use kernel::alloc::allocator::VmallocPageIter;
-/// use kernel::page::{AsPageIter, PAGE_SIZE};
+/// use kernel::{
+///     alloc::allocator::VmallocPageIter,
+///     page::{
+///         AsPageIter,
+///         PAGE_SIZE, //
+///     }, //
+/// };
 ///
 /// let mut vbox = VBox::new((), GFP_KERNEL)?;
 ///
index ad1839f1375ba5bf496b05d10fb06a95bf392372..6f35484387de9d39710cf44ec8e58bac9dc9a0cc 100644 (file)
@@ -1187,9 +1187,13 @@ where
 /// # Examples
 ///
 /// ```
-/// # use kernel::prelude::*;
-/// use kernel::alloc::allocator::VmallocPageIter;
-/// use kernel::page::{AsPageIter, PAGE_SIZE};
+/// use kernel::{
+///     alloc::allocator::VmallocPageIter,
+///     page::{
+///         AsPageIter,
+///         PAGE_SIZE, //
+///     }, //
+/// };
 ///
 /// let mut vec = VVec::<u8>::new();
 ///
index b629da4aed077a40d91e83c28e8a5a9585875633..62a459c66bafec898d834928119030f68b6c066b 100644 (file)
@@ -50,7 +50,10 @@ impl<T> ArrayLayout<T> {
     /// # Examples
     ///
     /// ```
-    /// # use kernel::alloc::layout::{ArrayLayout, LayoutError};
+    /// # use kernel::alloc::layout::{
+    /// #     ArrayLayout,
+    /// #     LayoutError, //
+    /// # };
     /// let layout = ArrayLayout::<i32>::new(15)?;
     /// assert_eq!(layout.len(), 15);
     ///