[PATCH v5 2/7] rust: devres: style for imports

Zhi Wang posted 7 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v5 2/7] rust: devres: style for imports
Posted by Zhi Wang 1 month, 1 week ago
Convert all imports in the devres to use "kernel vertical" style.

Signed-off-by: Zhi Wang <zhiw@nvidia.com>
---
 rust/kernel/devres.rs | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/rust/kernel/devres.rs b/rust/kernel/devres.rs
index 10a6a1789854..d4f3169248df 100644
--- a/rust/kernel/devres.rs
+++ b/rust/kernel/devres.rs
@@ -52,7 +52,15 @@ struct Inner<T: Send> {
 /// # Examples
 ///
 /// ```no_run
-/// # use kernel::{bindings, device::{Bound, Device}, devres::Devres, io::{Io, IoRaw}};
+/// # use kernel::{
+///     bindings,
+///     device::{Bound, Device},
+///     devres::Devres,
+///     io::{
+///         Io,
+///         IoRaw, //
+///     }, //
+/// };
 /// # use core::ops::Deref;
 ///
 /// // See also [`pci::Bar`] for a real example.
@@ -230,7 +238,11 @@ pub fn device(&self) -> &Device {
     ///
     /// ```no_run
     /// # #![cfg(CONFIG_PCI)]
-    /// # use kernel::{device::Core, devres::Devres, pci};
+    /// # use kernel::{
+    ///     device::Core,
+    ///     devres::Devres,
+    ///     pci, //
+    /// };
     ///
     /// fn from_core(dev: &pci::Device<Core>, devres: Devres<pci::Bar<0x4>>) -> Result {
     ///     let bar = devres.access(dev.as_ref())?;
@@ -333,7 +345,13 @@ fn register_foreign<P>(dev: &Device<Bound>, data: P) -> Result
 /// # Examples
 ///
 /// ```no_run
-/// use kernel::{device::{Bound, Device}, devres};
+/// use kernel::{
+///     device::{
+///         Bound,
+///         Device, //
+///     },
+///     devres, //
+/// };
 ///
 /// /// Registration of e.g. a class device, IRQ, etc.
 /// struct Registration;
-- 
2.51.0
Re: [PATCH v5 2/7] rust: devres: style for imports
Posted by Miguel Ojeda 1 month, 1 week ago
On Thu, Nov 6, 2025 at 11:28 AM Zhi Wang <zhiw@nvidia.com> wrote:
>
> +///     device::{Bound, Device},

Is this one converted?

> +    /// # use kernel::{
> +    ///     device::Core,

This hides only the first line, which will look quite confusing when
rendered -- please double-check with the `rustdoc` target.

Thanks!

Cheers,
Miguel
Re: [PATCH v5 2/7] rust: devres: style for imports
Posted by Zhi Wang 1 month, 1 week ago
On Thu, 6 Nov 2025 14:34:25 +0100
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:

> On Thu, Nov 6, 2025 at 11:28 AM Zhi Wang <zhiw@nvidia.com> wrote:
> >
> > +///     device::{Bound, Device},
> 
> Is this one converted?
> 
> > +    /// # use kernel::{
> > +    ///     device::Core,
> 
> This hides only the first line, which will look quite confusing when
> rendered -- please double-check with the `rustdoc` target.
> 

Thanks for the pointer. Let me take a look and fix it in the next
re-spin.

> Thanks!
> 
> Cheers,
> Miguel