Re: [PATCH 2/2] rust: alloc: cleanup doctest imports to "kernel vertical" style
From: Gary Guo
Date: Tue May 12 2026 - 10:12:08 EST
On Mon May 11, 2026 at 10:41 PM BST, Danilo Krummrich wrote:
> 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 [1]
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> rust/kernel/alloc/allocator.rs | 7 +++++--
> rust/kernel/alloc/kbox.rs | 17 +++++++++++------
> rust/kernel/alloc/kvec.rs | 10 +++++++---
> rust/kernel/alloc/layout.rs | 5 ++++-
> 4 files changed, 27 insertions(+), 12 deletions(-)
>
> diff --git a/rust/kernel/alloc/allocator.rs b/rust/kernel/alloc/allocator.rs
> index af20332d59f7..562e41925ada 100644
> --- a/rust/kernel/alloc/allocator.rs
> +++ b/rust/kernel/alloc/allocator.rs
> @@ -174,8 +174,11 @@ impl Vmalloc {
> /// # Examples
> ///
> /// ```
> - /// # use core::ptr::{NonNull, from_mut};
> - /// # use kernel::{page, prelude::*};
> + /// # use core::ptr::{
> + /// # from_mut,
> + /// # NonNull, //
> + /// # };
I thought the consensus was that hidden lines don't need to use vertical import
style. They're not prone to merge conflict, and it can be unnecessarily sparse
especially if there're a lot of imports. Did I misremember it?
Best,
Gary